Noobjay commited on
Commit
f0ff02a
Β·
verified Β·
1 Parent(s): e2c6d83

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
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')}" # Secret token sa Hugging Face settings
8
  }
9
 
10
  def smart_bot(message):
11
  prompt = f"""
12
- You are a helpful AI assistant. Reply in the same language as the input.
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(theme=gr.themes.Soft()) 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
- with gr.Row():
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