Spaces:
Runtime error
Runtime error
acecalisto3
commited on
Commit
•
a4c9236
1
Parent(s):
8c8eede
Update app.py
Browse files
app.py
CHANGED
@@ -123,6 +123,32 @@ def display_csv(selected_url):
|
|
123 |
else:
|
124 |
return "No CSV content available for the selected URL."
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
# Define the Gradio interface
|
127 |
def create_interface():
|
128 |
with gr.Blocks() as demo:
|
@@ -157,7 +183,7 @@ def create_interface():
|
|
157 |
stop_button.click(stop_scraping, outputs=csv_output)
|
158 |
|
159 |
# Connect message submission to the chat interface
|
160 |
-
message.submit(
|
161 |
|
162 |
# Add a button to display the CSV content for a selected URL
|
163 |
with gr.Row():
|
|
|
123 |
else:
|
124 |
return "No CSV content available for the selected URL."
|
125 |
|
126 |
+
def handle_message(message, chat_history, system_message, max_tokens, temperature, top_p):
|
127 |
+
# Process the message and update the chat history
|
128 |
+
chat_history.append((message, system_message))
|
129 |
+
response = f"Received message: {message}"
|
130 |
+
return chat_history, response
|
131 |
+
|
132 |
+
def generate_rss_feed(selected_url):
|
133 |
+
# Generate the RSS feed for the selected URL
|
134 |
+
# For this example, we'll just return a placeholder RSS feed
|
135 |
+
rss_feed = """
|
136 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
137 |
+
<rss version="2.0">
|
138 |
+
<channel>
|
139 |
+
<title>Example RSS Feed</title>
|
140 |
+
<link>https://example.com</link>
|
141 |
+
<description>This is an example RSS feed.</description>
|
142 |
+
<item>
|
143 |
+
<title>Example Item</title>
|
144 |
+
<link>https://example.com/item</link>
|
145 |
+
<description>This is an example item.</description>
|
146 |
+
</item>
|
147 |
+
</channel>
|
148 |
+
</rss>
|
149 |
+
"""
|
150 |
+
return rss_feed
|
151 |
+
|
152 |
# Define the Gradio interface
|
153 |
def create_interface():
|
154 |
with gr.Blocks() as demo:
|
|
|
183 |
stop_button.click(stop_scraping, outputs=csv_output)
|
184 |
|
185 |
# Connect message submission to the chat interface
|
186 |
+
message.submit(handle_message, inputs=[message, chat_history, system_message, max_tokens, temperature, top_p], outputs=[chat_history, response_box])
|
187 |
|
188 |
# Add a button to display the CSV content for a selected URL
|
189 |
with gr.Row():
|