anushkap01patidar commited on
Commit ·
075b97e
1
Parent(s): 0f8396a
deploying
Browse files- app.py +9 -9
- requirements.txt +24 -10
app.py
CHANGED
|
@@ -291,14 +291,14 @@ with gr.Blocks(css=css, title="Research Draft Generator") as demo:
|
|
| 291 |
session = gr.State({})
|
| 292 |
|
| 293 |
# Wire actions
|
|
|
|
|
|
|
|
|
|
|
|
|
| 294 |
def toggle_feedback_controls(state):
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
return upd, upd, upd, upd
|
| 299 |
-
except:
|
| 300 |
-
# Fallback if state is corrupted
|
| 301 |
-
return gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False), gr.update(interactive=False)
|
| 302 |
|
| 303 |
start_btn.click(run_workflow, inputs=[topic], outputs=[info, session, right_preview, pdf_file, right_header]).then(
|
| 304 |
toggle_feedback_controls, inputs=[session], outputs=[feedback, approve, revise, reject]
|
|
@@ -314,6 +314,6 @@ with gr.Blocks(css=css, title="Research Draft Generator") as demo:
|
|
| 314 |
)
|
| 315 |
|
| 316 |
|
| 317 |
-
# Launch the app for Hugging Face Spaces
|
| 318 |
if __name__ == "__main__":
|
| 319 |
-
|
|
|
|
|
|
| 291 |
session = gr.State({})
|
| 292 |
|
| 293 |
# Wire actions
|
| 294 |
+
# Left preview shows outline initially; right preview mirrors it. After approval, both show draft (right replaces outline visually)
|
| 295 |
+
def mirror_left_to_right(md):
|
| 296 |
+
return gr.update(visible=md["visible"], value=md["value"]) if isinstance(md, dict) else md
|
| 297 |
+
|
| 298 |
def toggle_feedback_controls(state):
|
| 299 |
+
enabled = bool(state and state.get("thread_id"))
|
| 300 |
+
upd = gr.update(interactive=enabled)
|
| 301 |
+
return upd, upd, upd, upd
|
|
|
|
|
|
|
|
|
|
|
|
|
| 302 |
|
| 303 |
start_btn.click(run_workflow, inputs=[topic], outputs=[info, session, right_preview, pdf_file, right_header]).then(
|
| 304 |
toggle_feedback_controls, inputs=[session], outputs=[feedback, approve, revise, reject]
|
|
|
|
| 314 |
)
|
| 315 |
|
| 316 |
|
|
|
|
| 317 |
if __name__ == "__main__":
|
| 318 |
+
port = int(os.getenv("PORT", 7860))
|
| 319 |
+
demo.queue().launch(server_name="0.0.0.0", server_port=port)
|
requirements.txt
CHANGED
|
@@ -1,11 +1,25 @@
|
|
| 1 |
gradio==5.43.1
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
gradio==5.43.1
|
| 2 |
+
transformers
|
| 3 |
+
torch
|
| 4 |
+
numpy
|
| 5 |
+
pandas
|
| 6 |
+
scikit-learn
|
| 7 |
+
matplotlib
|
| 8 |
+
seaborn
|
| 9 |
+
plotly
|
| 10 |
+
streamlit
|
| 11 |
+
langchain
|
| 12 |
+
openai
|
| 13 |
+
langchain-community
|
| 14 |
+
langchain-openai
|
| 15 |
+
anthropic
|
| 16 |
+
tiktoken
|
| 17 |
+
python-dotenv
|
| 18 |
+
requests
|
| 19 |
+
beautifulsoup4
|
| 20 |
+
markdown
|
| 21 |
+
fastapi
|
| 22 |
+
uvicorn
|
| 23 |
+
pydantic>=2
|
| 24 |
+
langgraph>=0.2.30
|
| 25 |
+
reportlab
|