Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
from sqlalchemy.exc import SQLAlchemyError
|
| 3 |
from utils import InnovativeIdea, init_db, get_db, SessionLocal, get_llm_response
|
| 4 |
from data_models import IdeaForm
|
| 5 |
-
from chatbot import InnovativeIdeaChatbot
|
| 6 |
from config import MODELS, DEFAULT_SYSTEM_PROMPT, STAGES
|
| 7 |
import logging
|
| 8 |
import os
|
|
@@ -90,12 +90,12 @@ def create_gradio_interface():
|
|
| 90 |
return chat_history, *[form_data.get(stage["field"], "") for stage in STAGES]
|
| 91 |
|
| 92 |
def start_over():
|
| 93 |
-
chat_history, form_data = innovative_chatbot.start_over()
|
| 94 |
return (
|
| 95 |
chat_history, # Update the chatbot with the new chat history
|
| 96 |
"", # Clear the message input
|
| 97 |
*[form_data.get(stage["field"], "") for stage in STAGES], # Reset all form fields
|
| 98 |
-
gr.update(value=
|
| 99 |
)
|
| 100 |
|
| 101 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
|
|
| 2 |
from sqlalchemy.exc import SQLAlchemyError
|
| 3 |
from utils import InnovativeIdea, init_db, get_db, SessionLocal, get_llm_response
|
| 4 |
from data_models import IdeaForm
|
| 5 |
+
from chatbot import InnovativeIdeaChatbot
|
| 6 |
from config import MODELS, DEFAULT_SYSTEM_PROMPT, STAGES
|
| 7 |
import logging
|
| 8 |
import os
|
|
|
|
| 90 |
return chat_history, *[form_data.get(stage["field"], "") for stage in STAGES]
|
| 91 |
|
| 92 |
def start_over():
|
| 93 |
+
chat_history, form_data, initial_stage = innovative_chatbot.start_over()
|
| 94 |
return (
|
| 95 |
chat_history, # Update the chatbot with the new chat history
|
| 96 |
"", # Clear the message input
|
| 97 |
*[form_data.get(stage["field"], "") for stage in STAGES], # Reset all form fields
|
| 98 |
+
gr.update(value=initial_stage) # Reset the stage selection
|
| 99 |
)
|
| 100 |
|
| 101 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|