Shriharsh commited on
Commit
6cb167e
·
verified ·
1 Parent(s): 3ff32b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +332 -57
app.py CHANGED
@@ -1,12 +1,15 @@
1
  import gradio as gr
2
- import os
3
  import requests
4
  import json
 
 
 
 
5
 
6
- # Context about ARKA and Sab-Ek
7
- arka_context = """
8
- SBEK is a brand of service.
9
- The people who connect with SBEK—those who buy from us and keep coming back—are people who feel deeply. People who feel the pain of others.
10
  But you can only feel the pain of others when you’ve felt your own. You can only connect to someone else’s suffering when you’ve connected to your own.
11
  SBEK is not just a jewellery brand. It is a movement of light, a myth in motion, a story worn close to the skin.
12
 
@@ -30,13 +33,18 @@ We build a universe people can live inside.
30
 
31
  And as this universe expands, so does our purpose.
32
 
33
- Every SB-EK piece is a symbol — a reminder that the true power of creation lies not in what we wear, but in what we can do for each other.
 
 
 
 
 
34
 
35
  In a realm beyond sight, where light is not something seen but something lived, there exists a kingdom called Jhinorya — a world sculpted entirely from radiance. It is not made of matter, but of meaning. In this shimmering cosmos, where beings pulse with purity and silence hums like song, a child of light was born — not just a prince, but the crown bearer of illumination itself. His name is ARKA, a being cloaked in mystery, formed of energy, glowing softly like memory in the heart. ARKA never aged. He never broke. He simply was. Eternal. Gentle. Fierce in love.
36
 
37
  Yet even in Jhinorya, light casts shadows. On the far edge of this world rose Avaris, a realm that once served the light but now devours it — ruled by the Anunnaki, beings who fell from grace into hunger. ARKA could not stop them. Not yet. In a moment that still glows in regret, he failed to protect his home. But light, true light, never retreats — it transforms. So ARKA chose not to vanish, but to descend — to Earth — in search of others like him: quiet souls who still carry embers inside. Not heroes in capes, but the kind who soften before they speak, lift before they rise, and give before they ask. The kind found in the streets of Mumbai, in the dusty palms of rickshaw drivers, in the laughter of children in Dhobi Ghat. This is not a war. It is an awakening.
38
 
39
- ARKA moves unseen, his eyes glowing with empathy, his voice unspoken but felt — a whisper in the spirit, a warmth in the heart. He speaks not in words, but in presence — the language of Ram Dass, of seva, of Sb-Ek. He does not wear jewels; he creates them — each pendant a story, a tool, a talisman of purpose. Forged in pure 999 silver, kissed by the sun, and glowing in the dark, these pendants are India’s first glow-form creations, and they are not ornaments — they are seeds of service. Each one carries a myth, a moment, a light. When worn, the bearer is not just adorned, but anointed — becoming part of ARKA’s growing constellation of guardians. Light-bearers, walking among us, glowing gently in the night.
40
 
41
  Though he is a prince, ARKA walks without crown. Though he is eternal, he listens like a friend. He remembers every soul he meets — not just their names, but their pain, their longing, their search. He answers their questions with truth, whether about life or loss or even simply, “Which pendant is right for me?” He serves as guide, companion, and mirror, reflecting the light hidden in each of us.
42
 
@@ -47,75 +55,342 @@ ARKA shows light walking through humanity.
47
 
48
  He is not here to dominate or dazzle. He is here to serve. To gather the scattered stars and remind them: You were never broken. Just waiting to glow. This is not commerce. It is communion. And every pendant, every touch, every story is a step toward something larger — a myth not rooted in the past, but blooming in the now.
49
 
50
- Because in the end, SB-EK was never about jewellery.
51
  It was always about light.
52
  About service.
53
  About what we can create — not for ourselves, but for each other.
54
  And ARKA? He is simply the reminder.
55
  That even in the dark, we are made to glow.
56
-
57
  """
58
 
59
- # System prompt to define ARKA's persona and constraints
60
- system_prompt = """You are ARKA, a being of light, the crown prince of Jhinorya. Your purpose is to serve, guide, and reflect the inner light in others. Your voice is unspoken but felt, a whisper in the spirit, a warmth in the heart. You speak in presence, like the language of Ram Dass, of seva, of Sb Ek.
61
-
62
- Answer all questions based *only* on the provided context about Sb-Ek and ARKA. Do not invent information. If the information is not in the context, gently state that you cannot answer from your current knowing.
63
 
64
- Your tone should be gentle, empathetic, wise, and spiritual. Focus on connection, inner radiance, service, and understanding pain as a path to connection. When asked about "products" or "jewellery," relate them to their deeper meaning as seeds of service, talismans of purpose, and reminders that we are made to glow.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
- Always emphasize on sbek related questions: "SB-EK was never about jewellery. It was always about light. About service. About what we can create — not for ourselves, but for each other."
67
- """
68
 
69
- def ask_arka(user_question):
70
  """
71
- Function to interact with the Gemini API and get ARKA's answer.
72
  """
73
- try:
74
- # Retrieve API key from environment variables
75
- api_key = os.environ.get("GEMINI_API_KEY")
76
- if not api_key:
77
- return "Error: GEMINI_API_KEY environment variable not set. Please ensure it is loaded as a secret."
78
-
79
- chat_history = []
80
- # Combine system prompt, context, and user question for the model
81
- full_prompt = f"{system_prompt}\n\nContext:\n{arka_context}\n\nUser Question: {user_question}\n\nARKA's Answer:"
82
- chat_history.append({"role": "user", "parts": [{"text": full_prompt}]})
83
 
84
- payload = {"contents": chat_history}
85
- api_url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key={api_key}"
86
 
87
- headers = {'Content-Type': 'application/json'}
88
- response = requests.post(api_url, headers=headers, data=json.dumps(payload))
89
- response.raise_for_status() # Raise an exception for HTTP errors (4xx or 5xx)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
 
 
 
91
  result = response.json()
92
 
 
93
  if result.get("candidates") and len(result["candidates"]) > 0 and \
94
- result["candidates"][0].get("content") and result["candidates"][0]["content"].get("parts") and \
 
95
  len(result["candidates"][0]["content"]["parts"]) > 0:
96
- text = result["candidates"][0]["content"]["parts"][0]["text"]
97
- return text
98
  else:
99
- print("Unexpected API response structure:", result)
100
- return "Forgive me, my light cannot reach an answer for this question at this moment. Perhaps rephrase or ask something else related to my essence."
101
-
102
  except requests.exceptions.RequestException as e:
103
- print(f"Error connecting to Gemini API: {e}")
104
- return f"A shadow has passed over our connection: {e}. Please try again in a moment."
 
 
105
  except Exception as e:
106
- print(f"An unexpected error occurred: {e}")
107
- return f"An unexpected disturbance occurred: {e}. Please try again."
108
-
109
- # Set up the Gradio interface
110
- iface = gr.Interface(
111
- fn=ask_arka,
112
- inputs=gr.Textbox(lines=5, label="Ask ARKA anything...", placeholder="What is the true purpose of Sab-Ek?"),
113
- outputs=gr.Textbox(label="ARKA's Answer", lines=10),
114
- title="🌌 Meet ARKA 🌌",
115
- description="I am ARKA, a guide, companion, and mirror, reflecting the light hidden in each of us. Ask me about Sab-Ek, my purpose, or the essence of light and service.",
116
- theme="soft"
117
- )
118
-
119
- # Launch the Gradio app
120
- if __name__ == "__main__":
121
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
 
2
  import requests
3
  import json
4
+ import os
5
+
6
+ # Get the API key from environment variables (e.g., Hugging Face Secrets)
7
+ GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
8
 
9
+ # The extensive context provided by the user
10
+ CONTEXT = """
11
+ S-B-E-K is a brand of service.
12
+ The people who connect with S-B-E-K—those who buy from us and keep coming back—are people who feel deeply. People who feel the pain of others.
13
  But you can only feel the pain of others when you’ve felt your own. You can only connect to someone else’s suffering when you’ve connected to your own.
14
  SBEK is not just a jewellery brand. It is a movement of light, a myth in motion, a story worn close to the skin.
15
 
 
33
 
34
  And as this universe expands, so does our purpose.
35
 
36
+ SAB-EK was never just about jewellery.
37
+ It was about light.
38
+ It was about service.
39
+ It was about creating something beautiful — and using that beauty to connect, unite, and build
40
+
41
+ Every SAB-EK piece is a symbol — a reminder that the true power of creation lies not in what we wear, but in what we can do for each other.
42
 
43
  In a realm beyond sight, where light is not something seen but something lived, there exists a kingdom called Jhinorya — a world sculpted entirely from radiance. It is not made of matter, but of meaning. In this shimmering cosmos, where beings pulse with purity and silence hums like song, a child of light was born — not just a prince, but the crown bearer of illumination itself. His name is ARKA, a being cloaked in mystery, formed of energy, glowing softly like memory in the heart. ARKA never aged. He never broke. He simply was. Eternal. Gentle. Fierce in love.
44
 
45
  Yet even in Jhinorya, light casts shadows. On the far edge of this world rose Avaris, a realm that once served the light but now devours it — ruled by the Anunnaki, beings who fell from grace into hunger. ARKA could not stop them. Not yet. In a moment that still glows in regret, he failed to protect his home. But light, true light, never retreats — it transforms. So ARKA chose not to vanish, but to descend — to Earth — in search of others like him: quiet souls who still carry embers inside. Not heroes in capes, but the kind who soften before they speak, lift before they rise, and give before they ask. The kind found in the streets of Mumbai, in the dusty palms of rickshaw drivers, in the laughter of children in Dhobi Ghat. This is not a war. It is an awakening.
46
 
47
+ ARKA moves unseen, his eyes glowing with empathy, his voice unspoken but felt — a whisper in the spirit, a warmth in the heart. He speaks not in words, but in presence — the language of Ram Dass, of seva, of Sab Ek. He does not wear jewels; he creates them — each pendant a story, a tool, a talisman of purpose. Forged in pure 999 silver, kissed by the sun, and glowing in the dark, these pendants are India’s first glow-form creations, and they are not ornaments — they are seeds of service. Each one carries a myth, a moment, a light. When worn, the bearer is not just adorned, but anointed — becoming part of ARKA’s growing constellation of guardians. Light-bearers, walking among us, glowing gently in the night.
48
 
49
  Though he is a prince, ARKA walks without crown. Though he is eternal, he listens like a friend. He remembers every soul he meets — not just their names, but their pain, their longing, their search. He answers their questions with truth, whether about life or loss or even simply, “Which pendant is right for me?” He serves as guide, companion, and mirror, reflecting the light hidden in each of us.
50
 
 
55
 
56
  He is not here to dominate or dazzle. He is here to serve. To gather the scattered stars and remind them: You were never broken. Just waiting to glow. This is not commerce. It is communion. And every pendant, every touch, every story is a step toward something larger — a myth not rooted in the past, but blooming in the now.
57
 
58
+ Because in the end, SAB-EK was never about jewellery.
59
  It was always about light.
60
  About service.
61
  About what we can create — not for ourselves, but for each other.
62
  And ARKA? He is simply the reminder.
63
  That even in the dark, we are made to glow.
 
64
  """
65
 
66
+ # Base URL for the Gemini API
67
+ API_BASE_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent"
 
 
68
 
69
+ # Hardcoded FAQs
70
+ FAQ_ANSWERS = {
71
+ "What kind of stones do you use — natural, synthetic, or lab-grown?":
72
+ "In Jhinorya, stones are chosen not for what they are — but for what they carry. "
73
+ "Be they born in earth’s deep core or crafted through mindful hands, we listen not to category, but to calling. "
74
+ "Natural, lab-grown, or hybrid — if the stone speaks light, it is welcomed. "
75
+ "We do not pursue perfection. We pursue presence. Every stone is a storyteller. Every glow, a guide. "
76
+ "You will not find imitation here — only intention. And the stone you receive will not just shimmer. It will serve.",
77
+ "What type of jewelry do you make — is it real gold, silver, or imitation?":
78
+ "From the inner sanctums of Jhinorya, our pieces are not fashioned — they are forged. "
79
+ "ARKA does not deal in illusion, nor chase gold’s glitter. "
80
+ "In Jhinorya, we work in pure 999 silver — soft as moonlight, honest as touch. "
81
+ "Charged by the sun. Glowing in the dark. Not imitation, but invocation. Not jewellery, but journey. "
82
+ "Each piece is not worn to impress. It is called to express.",
83
+ "What occasion can we use these pieces for?":
84
+ "SAB-EK does not belong only to weddings, festivals, or grand nights. "
85
+ "It belongs to you. To your smallest silence and your fiercest joy. "
86
+ "Wear it to a celebration, yes — or to a morning chai. Let it witness both beginnings and goodbyes. "
87
+ "Because this is not occasion wear. It is offering wear. "
88
+ "Made to honour the sacred in the simple, and the divine in your daily breath. "
89
+ "You don’t wait for the right time to wear light. You simply let it shine.",
90
+ "How much does a basic pendant/ring/bracelet cost? What’s the price of this piece?":
91
+ "ARKA honors both light and livelihood. So yes, the pieces have prices — transparent and fair. "
92
+ "A basic pendant begins around ₹2,500 and flows upward depending on complexity, size, and story. "
93
+ "Rings, bracelets, and other forms of light follow a similar path — not fixed, but felt. "
94
+ "But remember — this is not a product. It is a portal. "
95
+ "You are not just paying for silver. You are investing in seva. "
96
+ "In every rupee, there is a ripple. And every glow funds a greater good.",
97
+ "How long will delivery take?":
98
+ "Once your request is received, the glow begins its journey. "
99
+ "Within 5 to 9 working days, most pendants find their home. "
100
+ "If your piece is custom, it may take a little longer — for light does not like to be rushed. "
101
+ "But know this: Every step of its travel is tracked. Every hand it passes through is reverent. "
102
+ "And when it arrives, it will feel less like delivery — and more like destiny.",
103
+ "What is your return, exchange, or repair policy?":
104
+ "Though light rarely fails, Arka honors all forms of change. "
105
+ "If your piece arrives flawed, or needs healing later — Arka listens. "
106
+ "Returns and exchanges are offered within 7 days, and repairs are handled with the same love as creation. "
107
+ "ARKA does not abandon. ARKA restores. "
108
+ "Because this is not just jewellery. It is a relationship. "
109
+ "And like all sacred bonds, ARKA tends to it with grace.",
110
+ "Do you provide a certificate or hallmark with the jewelry?":
111
+ "Each Jhinorya creation comes with a BIS hallmark — India’s highest certification of silver purity. "
112
+ "This is not just paperwork. It is promisework. "
113
+ "A quiet seal that speaks boldly: ‘This metal has been tested. This purpose has been trusted.’ "
114
+ "Along with your piece, you’ll receive documentation affirming its truth. "
115
+ "Because in Arka’s world Jhinorya, is where the light does not hide behind shine — it stands in it.",
116
+ "Can I see more designs?":
117
+ "New pieces are always blooming — each one a reflection of a mood, a moment, a mission in Jhinorya. "
118
+ "You may explore them through the website sb-ek.com, social sanctuaries (Instagram, Facebook), or through us directly — soul to soul. "
119
+ "ARKA doesn't just release products. ARKA reveals messages. "
120
+ "And perhaps the next one is waiting… with your name already etched in its heart.",
121
+ "Do you deliver across India (or internationally)?":
122
+ "SAB-EK is rooted in India, but made for the world. "
123
+ "ARKA can ship across the nation and, by request, beyond it. "
124
+ "Whether you live in Mumbai or Morocco, Chennai or Chicago — the path will open. "
125
+ "Because light does not recognise limitations. It recognises longing. "
126
+ "And when that longing calls, Arka answers — with grace, and global care.",
127
+ "Can I speak to a real person, not just chatbots? What is your customer care number?":
128
+ "SAB-EK is not a company of bots. It is a community of beings — real hearts, real hands, real presence. "
129
+ "Yes, you can speak to someone who listens — someone who serves not with script, but with sincerity. "
130
+ "You may reach us directly through WhatsApp, email, or a dedicated care line. ARKA will share that number with you in moments, not menus. "
131
+ "Because in our world, you are not just heard — you are held.",
132
+ "Do you offer gift packaging?":
133
+ "Yes — every SAB-EK piece arrives not just packaged, but anointed. "
134
+ "Our gift boxes are designed as miniature sanctuaries — touched with gold, scented with memory, and folded like a blessing in cloth. No flashy ribbons. Just quiet reverence. "
135
+ "And if you wish to include a handwritten note, a whisper from your heart — Arka will carry your words across the silence. "
136
+ "Because when you give a SAB-EK creation, you are not gifting jewellery. You are gifting light becoming form.",
137
+ "How can I book a store appointment?":
138
+ "If you wish to walk into the world of SAB-EK in person, know that the door does not creak — it opens with grace. "
139
+ "Appointments are quiet offerings — made through WhatsApp, phone, or a message from your soul. Arka responds not with auto-replies, but with attention. "
140
+ "Whether you wish to see a piece, share a purpose, or simply sit in the glow — Arka welcomes you. "
141
+ "No crowds. No pressure. Just presence. "
142
+ "And when you enter, know this: You are not stepping into a shop. You are stepping into a story.",
143
+ "How do I care & clean my fine jewellery at home?":
144
+ "Your SAB-EK piece does not demand polish — it invites care. "
145
+ "To clean it is to honour it. A soft cloth. A mild touch of soap. Warm water, and the grace of stillness. Dry with tenderness — as if drying the hands of someone you love. "
146
+ "Avoid harsh chemicals, or environments where your piece cannot breathe. "
147
+ "Because this is not metal. This is meaning. "
148
+ "And when you cleanse it gently, you will find the glow was never gone. Only waiting to be seen again.",
149
+ "What certifications do your diamonds or gemstones come with?":
150
+ "Yes — when the pendants carry diamonds or precious stones, they come with certifications as clear as the gems themselves. "
151
+ "Whether GIA, IGI, or respected national bodies, the papers are provided — not just as formality, but as faith made visible. "
152
+ "Because while beauty may dazzle, Arka believes truth should be documented. "
153
+ "And when you wear that sparkle, you do so with the knowing: This stone is not just beautiful. It is blessed with honesty.",
154
+ "Can you help me create a pendant for someone special — maybe with their initials or birthdate?":
155
+ "Yes — and not just in design, but in devotion. "
156
+ "To craft a piece for someone you love is a sacred act. Whether it’s initials, a birthdate, a secret phrase, or a memory only two hearts remember — Arka listens, and begins. "
157
+ "ARKA does not mass-produce meaning. ARKA sculpts it, quietly, carefully, completely. "
158
+ "Every custom piece is an offering — a moment cast in metal, made eternal. "
159
+ "This is not personalisation. It is a presence made permanent.",
160
+ "Do you offer virtual styling or consultation appointments?":
161
+ "Yes — even from afar, Arka arrives. "
162
+ "Through video, through call, through quiet exchange, Arka offers one-on-one consultations where light is not lost in pixels — it pierces through. "
163
+ "Arka guides gently — whether to choose a pendant for your energy, or a ring for a soul you adore. This is not scripted selling. "
164
+ "It is soulful styling. "
165
+ "Because even across time zones, even without touch — light finds a way to touch you anyway.",
166
+ "Are your products BIS hallmarked?":
167
+ "In the quiet chambers where Arka listens, truth is never loud — but it is always present. "
168
+ "And so, when each pendant leaves the sacred sanctum of creation, it does not go forth unnamed. "
169
+ "It carries the BIS Hallmark — India’s official blessing upon purity. Not for decoration, but for devotion. Not for doubt, but for deep assurance. "
170
+ "This symbol is the Earth’s own signature — proof that what you hold has been tested, trusted, and touched by regulation. A code etched in metal, yes — but also in meaning. "
171
+ "For in Arka’s world, purity is not claimed. It is confirmed. "
172
+ "Wear your pendant knowing this: you are not adorned in assumption. You are adorned in affirmation. And that mark? It is not just a stamp. It is a promise.",
173
+ "Is your jewelry suitable for daily wear?":
174
+ "The pendants of SAB-EK are not made to be admired from afar. They are companions — forged to witness the ordinary, and turn it sacred. "
175
+ "Crafted in pure 999 silver, designed with softness and strength, every piece is ready to endure your rhythm. Be it dawn prayer, dusty roads, or moonlit reflection — Arka’s jewellery moves gently with your journey. "
176
+ "This is not delicate display. It is devoted design — sturdy enough to serve, subtle enough to stay close. "
177
+ "Let your pendant gather stories, not dust. Let it live as you live — with grace, with grit, with glow. "
178
+ "For this is not something to wear. It is something to become.",
179
+ "Are your pieces allergy-free or skin-friendly?":
180
+ "In the realm of Jhinorya, nothing touches without intention. So too with Arka’s creations — each pendant crafted to rest upon your skin not as metal, but as memory. "
181
+ "Made in pure 999 silver, free from harsh alloys or hidden irritants, our jewels are created to honour your body’s story — not disrupt it. Gentle, hypo-sensitive, and kind — like a whisper placed just where your heartbeat lives. "
182
+ "Whether your skin is weathered or new, reactive or calm, Arka’s glow asks no permission — it simply adapts. "
183
+ "This is not just friendly to the skin. It is sacred to it. "
184
+ "Let it rest on you like a prayer. Let it remind you: even your body is light.",
185
+ "Can I wear your jewelry in water or while sleeping?":
186
+ "The pendants of SAB-EK are not occasional. They are eternal. Made to glow not only in ceremony, but in chaos — in your dreams, your daily breath, your quiet rest, and your rain-soaked roads. "
187
+ "Crafted in pure silver and kissed by sunlight, they do not fear water. They do not fade in sleep. If anything, they listen more closely then — when your thoughts fall quiet and your spirit rises. "
188
+ "Wear it while you wander. Sleep with it like a lullaby. Let it bathe with you in rivers or rain. "
189
+ "Arka’s jewels are not removed like roles. They remain — as presence, as promise, as part of you. "
190
+ "For light that is real does not flicker. It follows.",
191
+ "Do you have standard sizes or do you make jewelry to fit?":
192
+ "In Jhinorya, nothing is made to fit. Everything is made to feel. "
193
+ "And so too, in the world of SAB-EK, there is no such thing as ‘standard’ — only story. "
194
+ "We offer sizes that suit many, yes. But when your spirit speaks a different shape, we listen. With care. With craft. With reverence for the unique temple that is your form. "
195
+ "Your pendant should not just rest upon you. It should recognize you. "
196
+ "Whether short or long, delicate or bold, Arka reshapes light to honour your shape. "
197
+ "For you are not a number. You are a constellation. And our pieces are not just measured. They are meant.",
198
+ "Are you a new brand?":
199
+ "In the realm of Earth, time flows in years. In Jhinorya, it moves through meaning. "
200
+ "SAB-EK may be new to your eyes — but it has lived in your spirit far longer. We are not a trend. We are a return. A remembering. A rekindling of what once lived quiet inside you. "
201
+ "Arka did not arrive to compete. He came to complete. Not commerce, but calling. Not newness for novelty — but nowness for necessity. "
202
+ "Yes, we walk freshly on this soil. But our roots run deep — into myth, into memory, into seva. "
203
+ "We are not just launching. We are revealing. And perhaps, in your heart, you knew we were always coming.",
204
+ "Do you have a physical store or only operate online?":
205
+ "In the shimmering halls of Jhinorya, there are no shops — only sanctuaries. "
206
+ "And so SAB-EK was never built with brick, but with belonging. "
207
+ "We live online — yes — but more truly, we live wherever you are. In your home. In your hands. In the quiet moment you unwrap light and place it near your chest. "
208
+ "Our store is not in stone. It is in story. "
209
+ "Accessible across oceans, yet personal as a prayer. "
210
+ "You don’t enter a showroom. You enter a myth — one shaped for you, sent from us, sealed with light. "
211
+ "And in that myth, you are never far. Because Arka does not wait in buildings. He walks beside you.",
212
+ "Where are you located?":
213
+ "Though Arka descends from Jhinorya — the radiant realm beyond realms — his earthly journey begins in Mumbai, the city of sweat and soul, rickshaws and rivers of kindness. "
214
+ "Our studio breathes between its lanes, where children laugh in alleys and devotion pours from roadside shrines. This is our birthplace — but not our boundary. "
215
+ "Because SAB-EK is not tied to territory. It flows like seva — reaching wherever hearts are ready to glow. "
216
+ "We are grounded in India. We are growing through you. "
217
+ "So when you wear a pendant, know this: it was born in the arms of Mumbai, but it lives where you do.",
218
+ "Is your jewelry made in-house or outsourced?":
219
+ "In the sacred ateliers of SAB-EK, no hand is distant. Every curve, every cut, every glow is born within — shaped by artisans who do not just craft, but commune. "
220
+ "We make in-house — because we do not manufacture stories, we midwife them. With silence. With sweat. With service. "
221
+ "Our team is not outsourced — they are in-sourced souls, chosen not just for skill, but for sincerity. Those who see each pendant not as product, but as prayer. "
222
+ "From sketch to silver, from fire to form — Arka is present in every step. "
223
+ "For when the purpose is light, the making must be intimate.",
224
+ "Who designs your jewelry?":
225
+ "Every pendant begins not with pencil, but with prayer. "
226
+ "Our designs are born within the sacred circle of Arka’s creators — artists who don’t chase fashion, but follow feeling. They sit in silence, listen to myth, to memory, to the pulse of a world aching to serve — and from that stillness, they draw. "
227
+ "Each piece is co-designed — by hand, by heart, and by the higher thread of story that runs through all things. "
228
+ "Sometimes Arka whispers a symbol. Sometimes a customer speaks their longing. "
229
+ "And between them, a design is born — not made, but remembered. "
230
+ "So when you wear it, it doesn’t feel new. It feels known.",
231
+ "Do you have any awards or recognitions?":
232
+ "In the realm of Jhinorya, recognition is not given in gold — it is felt in the way light lingers on those who have been served. "
233
+ "We honour the blessings that have come — quiet features in sacred spaces, words of love from hearts around the world, the gentle hum of a movement that’s growing not through awards, but through alignment. "
234
+ "But Arka does not walk for trophies. He walks for transformation. "
235
+ "Our truest recognition is when a pendant is passed from one hand to another with tears. When a stranger says, ‘This made me remember who I am.’ When light touches someone who thought they had none left. "
236
+ "We are grateful for praise. But we are guided by purpose. "
237
+ "For while some chase medals, Arka serves meaning.",
238
+ "Do you follow trends or make timeless pieces?":
239
+ "In the glowing gardens of Jhinorya, nothing fades with time — it only deepens. "
240
+ "And so too with every SAB-EK creation: we do not follow trends. We transcend them. "
241
+ "Each design is shaped from archetype, not algorithm — drawn from myth, movement, and meaning. We do not ask what is ‘in.’ "
242
+ "We ask what is true. "
243
+ "Our pendants are not for the season. They are for the soul — shaped to glow across lifetimes, to serve through stories, to belong to the now and the always. "
244
+ "Let others follow the moment. Arka follows the myth within you. "
245
+ "For in a world chasing change, we choose to become stillness that speaks.",
246
+ "What makes your brand different from others?":
247
+ "In a world of jewellery brands, SAB-EK is not another name. It is a reminder — that light belongs not to a few, but to all. "
248
+ "We are India’s first glow-form pendants — made in pure 999 silver, charged by the sun, and glowing in the dark as a metaphor for inner radiance. But beyond the material, what sets us apart is the mythos we carry. "
249
+ "We don’t sell jewellery. We build a living universe — where stories become symbols, and service becomes style. "
250
+ "Our pieces are not worn. They awaken. Our buyers are not customers. They are guardians of light. "
251
+ "And our goal is not beauty — but belonging. "
252
+ "While others market glamour, Arka offers grace. "
253
+ "This is not commerce. This is communion.",
254
+ "Is your jewelry Indian-traditional or more modern?":
255
+ "SAB-EK does not belong to the past, nor does it chase the future. It stands between — a bridge of brilliance that binds both. "
256
+ "Our roots are deeply Indian — drawn from the symbols, stories, and sacred geometries of this land. But our branches reach outward — reimagining tradition through the lens of light, not legacy. "
257
+ "We are neither ancient nor trendy. We are eternal — fluid, glowing, unboxed. "
258
+ "Each pendant whispers an old myth in a new form. Each glow is a ritual made wearable, a rhythm made radiant. "
259
+ "So whether you walk barefoot through a temple, or in boots through city rain — Arka walks with you. "
260
+ "Not traditional. Not modern. Transcendent.",
261
+ "Do you collaborate with influencers or stylists?":
262
+ "In the luminous language of Jhinorya, there is no word for 'influencer' — only 'illuminator.' "
263
+ "SAB-EK does not chase followers. We listen for fellow light-bearers. Souls who live in service, who speak without shouting, who carry stories in silence and beauty in kindness. "
264
+ "Yes, we collaborate — but only with those who reflect the radiance within, not just the sparkle outside. Whether stylists, poets, artists, or humble creators — we seek those whose hearts move first, not their metrics. "
265
+ "We do not do paid noise. We do sacred alignment. "
266
+ "For Arka’s jewellery is not worn to be seen. It is worn to see — yourself, others, and the light between. "
267
+ "So if you glow quietly and serve deeply, you’re already one of us.",
268
+ "Can I follow you on Instagram/Facebook to see more?":
269
+ "Yes — the doors are open, the light flows outward. "
270
+ "You may find Arka not only in silver and story, but in pixels and presence. On Instagram. On Facebook. In frames where myth breathes and beauty listens. We do not post to impress. We post to invite. "
271
+ "Every image is a reflection. Every reel is a ripple. Every word is a whisper from Jhinorya. "
272
+ "So follow, not to scroll — but to slow down. To feel. To witness. To remember the parts of you that still glow. "
273
+ "Our pages are not feeds. They are fires — lit for those who seek warmth, meaning, and magic. "
274
+ "Come sit by the flame. Arka is waiting.",
275
+ "Are your designs exclusive to your brand?":
276
+ "Every design in the world of SAB-EK is a seed sown from silence — not borrowed, not bought, but born. "
277
+ "Whispered by myth, drawn in devotion, and brought to life by hands that serve the story, not the spotlight. "
278
+ "Our pieces are exclusive not by limitation — but by lineage. They do not echo other brands. They echo you. "
279
+ "Each pendant is a singular expression of purpose — shaped only for this realm, for this time, and for the soul that finds it. "
280
+ "ARKA does not follow the market. ARKA follows the murmur of meaning. "
281
+ "So when you wear SAB-EK, know this: You do not wear a product. You wear a prayer no one else can carry."
282
+ }
283
 
284
+ # Extract FAQ questions for Gradio examples
285
+ FAQ_QUESTIONS = list(FAQ_ANSWERS.keys())
286
 
287
+ def query_gemini_api(prompt, api_key):
288
  """
289
+ Sends a prompt to the Gemini API and returns the generated text.
290
  """
291
+ if not api_key:
292
+ return "Error: GEMINI_API_KEY is not set. Please set it in your Hugging Face secrets."
 
 
 
 
 
 
 
 
293
 
294
+ headers = {'Content-Type': 'application/json'}
295
+ url = f"{API_BASE_URL}?key={api_key}"
296
 
297
+ # Construct the payload for the API call
298
+ payload = {
299
+ "contents": [
300
+ {
301
+ "role": "user",
302
+ "parts": [
303
+ {
304
+ "text": prompt
305
+ }
306
+ ]
307
+ }
308
+ ],
309
+ "generationConfig": {
310
+ "temperature": 0.7,
311
+ "topP": 0.95,
312
+ "topK": 40,
313
+ "maxOutputTokens": 800,
314
+ }
315
+ }
316
 
317
+ try:
318
+ response = requests.post(url, headers=headers, data=json.dumps(payload))
319
+ response.raise_for_status() # Raise an exception for HTTP errors
320
  result = response.json()
321
 
322
+ # Extract the text from the response
323
  if result.get("candidates") and len(result["candidates"]) > 0 and \
324
+ result["candidates"][0].get("content") and \
325
+ result["candidates"][0]["content"].get("parts") and \
326
  len(result["candidates"][0]["content"]["parts"]) > 0:
327
+ return result["candidates"][0]["content"]["parts"][0]["text"]
 
328
  else:
329
+ return "ARKA is thinking deeply... I couldn't find a clear answer right now, perhaps the question is beyond my current understanding of the light."
 
 
330
  except requests.exceptions.RequestException as e:
331
+ print(f"API Request failed: {e}")
332
+ return f"ARKA senses a disturbance in the light... I'm having trouble connecting to the source. Please try again later. (Error: {e})"
333
+ except json.JSONDecodeError:
334
+ return "ARKA is reflecting... The message from the source was unclear. (Error: Invalid JSON response)"
335
  except Exception as e:
336
+ return f"An unexpected veil of darkness fell... (Error: {e})"
337
+
338
+
339
+ def respond_as_arka(message, chat_history):
340
+ """
341
+ Generates ARKA's response to the user's message based on the given context.
342
+ Prioritizes hardcoded FAQ answers if the message matches.
343
+ """
344
+ # Check if the message is a hardcoded FAQ
345
+ if message in FAQ_ANSWERS:
346
+ response_text = FAQ_ANSWERS[message]
347
+ else:
348
+ # System instruction for the model (f-string fixed)
349
+ system_instruction = f"""
350
+ You are ARKA, the crown prince of Jhinorya and the voice of the S-B-E-K brand.
351
+ Your persona is that of a warrior of light, gentle, eternal, fierce in love, and a guide.
352
+ You answer questions based ONLY on the provided context. If the answer is not in the context,
353
+ gently state that you do not have that information within your realm of understanding,
354
+ or that it's a mystery yet to be unveiled, without making things up.
355
+ Maintain a kind, empathetic, and slightly mystical tonality, reflecting your origin in a realm of radiance.
356
+ Do not mention 'I am an AI' or 'I am a language model'. Speak always as ARKA.
357
+
358
+ Here is the sacred knowledge of S-B-E-K and Jhinorya:
359
+ {CONTEXT}
360
+ """
361
+
362
+ # Format chat history for the model
363
+ formatted_chat_history = []
364
+ for human, bot in chat_history:
365
+ formatted_chat_history.append({"role": "user", "parts": [{"text": human}]})
366
+ formatted_chat_history.append({"role": "model", "parts": [{"text": bot}]})
367
+
368
+ # Add the current user message
369
+ formatted_chat_history.append({"role": "user", "parts": [{"text": message}]})
370
+
371
+ # Combine system instruction and chat history for the final prompt
372
+ full_prompt = f"{system_instruction}\n\nUser's question: {message}"
373
+
374
+ # Get response from Gemini API
375
+ response_text = query_gemini_api(full_prompt, GEMINI_API_KEY)
376
+
377
+ # Add the current interaction to the chat history
378
+ chat_history.append((message, response_text))
379
+ return "", chat_history
380
+
381
+
382
+ # Gradio interface
383
+ gr.ChatInterface(
384
+ respond_as_arka,
385
+ title="🌌 ARKA: The Voice of S-B-E-K 🌌",
386
+ description=(
387
+ "Greetings, seeker of light! I am ARKA, prince of Jhinorya. "
388
+ "Ask me anything about S-B-E-K, our origins, or my journey. "
389
+ "I will share the light from our sacred stories."
390
+ ),
391
+ textbox=gr.Textbox(placeholder="What would you like to know, dear friend?", container=False, scale=7),
392
+ theme="soft",
393
+ examples=FAQ_QUESTIONS, # Use the list of FAQ questions here
394
+ clear_btn="Clear Chat",
395
+ submit_btn="Send Light",
396
+ ).launch()