Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| def answer_question(project_data, question): | |
| # Process the project_data and question to generate an answer | |
| # Replace this with your actual logic | |
| answer = f"Answer to '{question}' based on '{project_data}': [Your Answer Here]" | |
| return answer | |
| with gr.Blocks() as demo: # Create a Blocks context | |
| project_data = gr.Textbox(label="Project Data", lines=2, value=state.context) | |
| output = gr.Textbox(label="Output") | |
| def on_message(event): | |
| # Update the textbox value based on the received message | |
| state.context = event.data | |
| iface.set_value(project_data, value=state.context) | |
| iface.set_value(output, value=state.context) | |
| iface.js_code("window.addEventListener("message", on_message);) | |
| iface.launch( | |
| server_name="0.0.0.0", # Allow external connections | |
| share=True, # Create public URL | |
| allowed_paths=["*"], #Allow CORS | |
| ) |