Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -80,7 +80,7 @@ def start_scraping(storage_location, urls, scrape_interval, content_type, stop_s
|
|
80 |
try:
|
81 |
with webdriver.Chrome(service=Service(webdriver.ChromeDriverManager().install()), options=Options()) as driver:
|
82 |
driver.get(url)
|
83 |
-
time.sleep(2) # Wait for the page to load
|
84 |
if content_type == "text":
|
85 |
initial_content = driver.page_source
|
86 |
elif content_type == "media":
|
@@ -104,6 +104,12 @@ def stop_scraping(stop_scraping_flag):
|
|
104 |
stop_scraping_flag[0] = True
|
105 |
return "Scraping stopped."
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
# Define the Gradio interface
|
108 |
def create_interface():
|
109 |
with gr.Blocks() as demo:
|
@@ -128,10 +134,10 @@ def create_interface():
|
|
128 |
|
129 |
stop_scraping_flag = [False]
|
130 |
start_button.click(
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
)
|
135 |
stop_button.click(stop_scraping, inputs=[stop_scraping_flag], outputs=[csv_output])
|
136 |
message.submit(chat_interface, inputs=[message, chat_history, system_message, max_tokens, temperature, top_p], outputs=[chat_history, response_box])
|
137 |
|
|
|
80 |
try:
|
81 |
with webdriver.Chrome(service=Service(webdriver.ChromeDriverManager().install()), options=Options()) as driver:
|
82 |
driver.get(url)
|
83 |
+
time.sleep(2 ) # Wait for the page to load
|
84 |
if content_type == "text":
|
85 |
initial_content = driver.page_source
|
86 |
elif content_type == "media":
|
|
|
104 |
stop_scraping_flag[0] = True
|
105 |
return "Scraping stopped."
|
106 |
|
107 |
+
# Define a function to update model config
|
108 |
+
def update_model_config(model_name_input, gpu_layers_input):
|
109 |
+
# Example implementation of update_model_config
|
110 |
+
# You can replace this with the actual logic you need
|
111 |
+
return f"Model config updated with model: {model_name_input}, GPU layers: {gpu_layers_input}"
|
112 |
+
|
113 |
# Define the Gradio interface
|
114 |
def create_interface():
|
115 |
with gr.Blocks() as demo:
|
|
|
134 |
|
135 |
stop_scraping_flag = [False]
|
136 |
start_button.click(
|
137 |
+
fn=update_model_config,
|
138 |
+
inputs=[model_name_input, gpu_layers_input],
|
139 |
+
outputs="text"
|
140 |
+
)
|
141 |
stop_button.click(stop_scraping, inputs=[stop_scraping_flag], outputs=[csv_output])
|
142 |
message.submit(chat_interface, inputs=[message, chat_history, system_message, max_tokens, temperature, top_p], outputs=[chat_history, response_box])
|
143 |
|