Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,12 +4,12 @@ import os
|
|
| 4 |
|
| 5 |
API_URL = "https://api-inference.huggingface.co/models/tiiuae/falcon-7b-instruct"
|
| 6 |
headers = {
|
| 7 |
-
"Authorization": f"Bearer {os.getenv('HF_API_TOKEN')}"
|
| 8 |
}
|
| 9 |
|
| 10 |
def smart_bot(message):
|
| 11 |
prompt = f"""
|
| 12 |
-
You are a helpful
|
| 13 |
User: {message}
|
| 14 |
Assistant:"""
|
| 15 |
|
|
@@ -23,14 +23,13 @@ Assistant:"""
|
|
| 23 |
else:
|
| 24 |
return f"β Error {response.status_code}: {response.text}"
|
| 25 |
|
| 26 |
-
with gr.Blocks(
|
| 27 |
gr.Markdown("<h1 style='text-align: center;'>π€ Tagalog-English AI ChatBot</h1>")
|
| 28 |
gr.Markdown("<marquee style='color: black; font-weight: bold;'>Created by Niko Sedan using Falcon 7B</marquee>")
|
| 29 |
|
| 30 |
-
|
| 31 |
-
user_input = gr.Textbox(label="π¬ Your Message")
|
| 32 |
-
send_btn = gr.Button("Send")
|
| 33 |
bot_output = gr.Textbox(label="π€ Bot's Reply")
|
|
|
|
| 34 |
|
| 35 |
send_btn.click(fn=smart_bot, inputs=user_input, outputs=bot_output)
|
| 36 |
|
|
|
|
| 4 |
|
| 5 |
API_URL = "https://api-inference.huggingface.co/models/tiiuae/falcon-7b-instruct"
|
| 6 |
headers = {
|
| 7 |
+
"Authorization": f"Bearer {os.getenv('HF_API_TOKEN')}"
|
| 8 |
}
|
| 9 |
|
| 10 |
def smart_bot(message):
|
| 11 |
prompt = f"""
|
| 12 |
+
You are a helpful assistant. Reply in the same language as the user input.
|
| 13 |
User: {message}
|
| 14 |
Assistant:"""
|
| 15 |
|
|
|
|
| 23 |
else:
|
| 24 |
return f"β Error {response.status_code}: {response.text}"
|
| 25 |
|
| 26 |
+
with gr.Blocks() as app:
|
| 27 |
gr.Markdown("<h1 style='text-align: center;'>π€ Tagalog-English AI ChatBot</h1>")
|
| 28 |
gr.Markdown("<marquee style='color: black; font-weight: bold;'>Created by Niko Sedan using Falcon 7B</marquee>")
|
| 29 |
|
| 30 |
+
user_input = gr.Textbox(label="π¬ Your Message")
|
|
|
|
|
|
|
| 31 |
bot_output = gr.Textbox(label="π€ Bot's Reply")
|
| 32 |
+
send_btn = gr.Button("Send")
|
| 33 |
|
| 34 |
send_btn.click(fn=smart_bot, inputs=user_input, outputs=bot_output)
|
| 35 |
|