chat bot with analysis
Browse files
README.md
CHANGED
|
@@ -1,14 +1,11 @@
|
|
| 1 |
---
|
| 2 |
title: Sambit AI
|
| 3 |
emoji: π€
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
|
|
|
| 10 |
---
|
| 11 |
-
|
| 12 |
-
# Sambit AI - Voice-enabled AI chatbot
|
| 13 |
-
|
| 14 |
-
Mobile-optimized chatbot built with Gradio + Together.ai API.
|
|
|
|
| 1 |
---
|
| 2 |
title: Sambit AI
|
| 3 |
emoji: π€
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.24.0
|
| 8 |
+
app_file: main.py
|
| 9 |
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
---
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import os
|
|
@@ -34,48 +35,3 @@ def ask_ai(message, history):
|
|
| 34 |
return reply
|
| 35 |
except Exception as e:
|
| 36 |
return f"β Error: {str(e)}"
|
| 37 |
-
|
| 38 |
-
with gr.Blocks(
|
| 39 |
-
theme=gr.themes.Base(),
|
| 40 |
-
css="""
|
| 41 |
-
.gradio-container {
|
| 42 |
-
max-width: 100% !important;
|
| 43 |
-
padding: 1rem;
|
| 44 |
-
font-family: 'Poppins', sans-serif;
|
| 45 |
-
}
|
| 46 |
-
#header-title {
|
| 47 |
-
text-align: center;
|
| 48 |
-
font-weight: 700;
|
| 49 |
-
font-size: 2rem;
|
| 50 |
-
margin-bottom: 0.25rem;
|
| 51 |
-
}
|
| 52 |
-
#subtext {
|
| 53 |
-
text-align: center;
|
| 54 |
-
font-weight: 300;
|
| 55 |
-
font-size: 1rem;
|
| 56 |
-
margin-bottom: 1rem;
|
| 57 |
-
}
|
| 58 |
-
"""
|
| 59 |
-
) as demo:
|
| 60 |
-
with gr.Column():
|
| 61 |
-
gr.Markdown("Sambit AI", elem_id="header-title")
|
| 62 |
-
gr.Markdown("powered by acrilc", elem_id="subtext")
|
| 63 |
-
|
| 64 |
-
chatbot = gr.Chatbot(label="Chat with Sambit AI", height=400)
|
| 65 |
-
with gr.Row():
|
| 66 |
-
msg = gr.Textbox(placeholder="Ask anything...", scale=4)
|
| 67 |
-
send = gr.Button("Send", scale=1)
|
| 68 |
-
|
| 69 |
-
clear = gr.Button("π§Ή Clear chat")
|
| 70 |
-
state = gr.State([])
|
| 71 |
-
|
| 72 |
-
def respond(message, history):
|
| 73 |
-
reply = ask_ai(message, history)
|
| 74 |
-
history.append((message, reply))
|
| 75 |
-
return history, ""
|
| 76 |
-
|
| 77 |
-
send.click(respond, [msg, state], [chatbot, msg])
|
| 78 |
-
msg.submit(respond, [msg, state], [chatbot, msg])
|
| 79 |
-
clear.click(lambda: ([], ""), None, [chatbot, msg])
|
| 80 |
-
|
| 81 |
-
demo.launch()
|
|
|
|
| 1 |
+
|
| 2 |
import gradio as gr
|
| 3 |
import requests
|
| 4 |
import os
|
|
|
|
| 35 |
return reply
|
| 36 |
except Exception as e:
|
| 37 |
return f"β Error: {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
-
#
|
| 5 |
tracking_script = """
|
| 6 |
<!-- Google tag (gtag.js) -->
|
| 7 |
<script async src="https://www.googletagmanager.com/gtag/js?id=G-CLNDQ829HZ"></script>
|
|
@@ -13,15 +14,14 @@ tracking_script = """
|
|
| 13 |
</script>
|
| 14 |
"""
|
| 15 |
|
| 16 |
-
# Simple chatbot function
|
| 17 |
-
def chatbot_response(message):
|
| 18 |
-
return f"π Hi there! You said: {message}"
|
| 19 |
-
|
| 20 |
-
# Create the UI
|
| 21 |
with gr.Blocks() as demo:
|
| 22 |
gr.HTML(tracking_script)
|
| 23 |
gr.Markdown("## π€ Welcome to Sambit AI!")
|
| 24 |
-
gr.ChatInterface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
# Launch the app (Gradio handles this on Spaces)
|
| 27 |
demo.launch()
|
|
|
|
| 1 |
|
| 2 |
import gradio as gr
|
| 3 |
+
from app import ask_ai
|
| 4 |
|
| 5 |
+
# GA4 tracking
|
| 6 |
tracking_script = """
|
| 7 |
<!-- Google tag (gtag.js) -->
|
| 8 |
<script async src="https://www.googletagmanager.com/gtag/js?id=G-CLNDQ829HZ"></script>
|
|
|
|
| 14 |
</script>
|
| 15 |
"""
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
with gr.Blocks() as demo:
|
| 18 |
gr.HTML(tracking_script)
|
| 19 |
gr.Markdown("## π€ Welcome to Sambit AI!")
|
| 20 |
+
gr.ChatInterface(
|
| 21 |
+
fn=ask_ai,
|
| 22 |
+
title="Sambit AI π€ β Powered by Together & LLaMA 3",
|
| 23 |
+
chatbot=gr.Chatbot(type="messages"),
|
| 24 |
+
description="Ask anything. Sambit AI uses Together's Mixtral 8x7B model."
|
| 25 |
+
)
|
| 26 |
|
|
|
|
| 27 |
demo.launch()
|