acecalisto3 commited on
Commit
14cbb01
·
verified ·
1 Parent(s): 38369d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -134,25 +134,31 @@ def respond(
134
  yield response
135
 
136
  # Create Gradio interface
137
- demo = gr.ChatInterface(
138
- respond,
139
- additional_inputs=[
 
 
 
 
 
 
 
 
140
  gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
141
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
142
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
143
- gr.Slider(
144
- minimum=0.1,
145
- maximum=1.0,
146
- value=0.95,
147
- step=0.05,
148
- label="Top-p (nucleus sampling)",
149
- ),
150
  gr.Textbox(value=default_file_path, label="Storage Location"),
151
  gr.Textbox(value="https://www.culver.k12.in.us/", label="URL 1"),
152
  gr.Textbox(value="https://www.facebook.com/CulverCommunitySchools", label="URL 2"),
153
  gr.Slider(minimum=1, maximum=60, value=5, step=1, label="Scrape Interval (minutes)"),
154
  gr.Radio(choices=["text", "media", "both"], value="text", label="Content Type"),
155
  ],
 
 
 
 
156
  title="Culvers Site Monitor and Chatbot",
157
  description="Monitor changes on Culvers' websites and log them into a CSV file. Also, chat with a friendly chatbot."
158
  )
 
134
  yield response
135
 
136
  # Create Gradio interface
137
+ def chat_interface(message, system_message, max_tokens, temperature, top_p, storage_location, url1, url2, scrape_interval, content_type):
138
+ global history
139
+ response = respond(message, history, system_message, max_tokens, temperature, top_p)
140
+ history.append((message, response))
141
+ handle_input(storage_location, url1, url2, scrape_interval, content_type)
142
+ return history, ""
143
+
144
+ demo = gr.Interface(
145
+ fn=chat_interface,
146
+ inputs=[
147
+ gr.Textbox(label="Message"),
148
  gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
149
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
150
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
151
+ gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
 
 
 
 
 
 
152
  gr.Textbox(value=default_file_path, label="Storage Location"),
153
  gr.Textbox(value="https://www.culver.k12.in.us/", label="URL 1"),
154
  gr.Textbox(value="https://www.facebook.com/CulverCommunitySchools", label="URL 2"),
155
  gr.Slider(minimum=1, maximum=60, value=5, step=1, label="Scrape Interval (minutes)"),
156
  gr.Radio(choices=["text", "media", "both"], value="text", label="Content Type"),
157
  ],
158
+ outputs=[
159
+ gr.Chatbot(label="Chat History"),
160
+ gr.Textbox(label="Response")
161
+ ],
162
  title="Culvers Site Monitor and Chatbot",
163
  description="Monitor changes on Culvers' websites and log them into a CSV file. Also, chat with a friendly chatbot."
164
  )