Spaces:
No application file
No application file
Liss, Alex (NYC-HUG)
commited on
Commit
Β·
1404938
1
Parent(s):
f389d98
further file cleanup
Browse files- GRADIO_README.md +0 -74
- docs/requirements.md +1 -9
- gradio_app.py +2 -2
GRADIO_README.md
DELETED
@@ -1,74 +0,0 @@
|
|
1 |
-
# 49ers FanAI Hub - Gradio Version
|
2 |
-
|
3 |
-
This is the Gradio version of the 49ers FanAI Hub, a conversational AI application that provides information about the San Francisco 49ers football team, players, games, and fan communities.
|
4 |
-
|
5 |
-
## Overview
|
6 |
-
|
7 |
-
This application uses:
|
8 |
-
- **Gradio** for the web interface
|
9 |
-
- **LangChain** for the agent framework
|
10 |
-
- **Neo4j** for the graph database
|
11 |
-
- **OpenAI** for the language model
|
12 |
-
- **Zep** for memory management
|
13 |
-
|
14 |
-
## Files
|
15 |
-
|
16 |
-
- `gradio_app.py` - Main application file with Gradio UI
|
17 |
-
- `gradio_utils.py` - Utility functions for the Gradio app
|
18 |
-
- `gradio_graph.py` - Neo4j graph connection without Streamlit dependencies
|
19 |
-
- `gradio_llm.py` - Language model initialization without Streamlit dependencies
|
20 |
-
- `gradio_requirements.txt` - Dependencies for the Gradio version
|
21 |
-
|
22 |
-
## Setup
|
23 |
-
|
24 |
-
1. Install the required dependencies:
|
25 |
-
```
|
26 |
-
pip install -r gradio_requirements.txt
|
27 |
-
```
|
28 |
-
|
29 |
-
2. Set up environment variables (create a `.env` file or set them in your environment):
|
30 |
-
```
|
31 |
-
# OpenAI API
|
32 |
-
OPENAI_API_KEY=your_openai_api_key
|
33 |
-
OPENAI_MODEL=gpt-4-turbo # or another model
|
34 |
-
|
35 |
-
# Neo4j Database
|
36 |
-
NEO4J_URI=your_neo4j_uri
|
37 |
-
NEO4J_USERNAME=your_neo4j_username
|
38 |
-
NEO4J_PASSWORD=your_neo4j_password
|
39 |
-
|
40 |
-
# Zep Memory (optional)
|
41 |
-
ZEP_API_KEY=your_zep_api_key
|
42 |
-
```
|
43 |
-
|
44 |
-
3. Run the application:
|
45 |
-
```
|
46 |
-
python gradio_app.py
|
47 |
-
```
|
48 |
-
|
49 |
-
4. Open your browser and navigate to the URL shown in the terminal (typically http://127.0.0.1:7860)
|
50 |
-
|
51 |
-
## Features
|
52 |
-
|
53 |
-
- Chat interface for asking questions about the 49ers
|
54 |
-
- Integration with Neo4j graph database for structured data queries
|
55 |
-
- Memory management with Zep for conversation history
|
56 |
-
- Support for various query types:
|
57 |
-
- Information about players, games, and fans
|
58 |
-
- Finding games based on descriptions
|
59 |
-
- Discovering connections between people in the 49ers industry
|
60 |
-
|
61 |
-
## Differences from Streamlit Version
|
62 |
-
|
63 |
-
This Gradio version provides the same functionality as the Streamlit version but with a different UI framework. Key differences include:
|
64 |
-
|
65 |
-
1. **State Management**: Uses a custom AppState class instead of Streamlit's session_state
|
66 |
-
2. **UI Components**: Uses Gradio's chat interface instead of Streamlit's chat components
|
67 |
-
3. **Error Handling**: Uses console logging instead of Streamlit's error display
|
68 |
-
4. **Session Management**: Uses global variables for session IDs instead of Streamlit's session context
|
69 |
-
|
70 |
-
## Troubleshooting
|
71 |
-
|
72 |
-
- If you encounter connection issues with Neo4j, check your database credentials and network connectivity
|
73 |
-
- If the OpenAI API is not working, verify your API key and model name
|
74 |
-
- For Zep memory issues, ensure the Zep service is running and your API key is correct
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/requirements.md
CHANGED
@@ -371,7 +371,6 @@ ifx-sandbox/
|
|
371 |
βββ .github/ # GitHub specific files (e.g., workflows - check if used).
|
372 |
βββ .gitignore # Specifies intentionally untracked files that Git should ignore.
|
373 |
βββ .gradio/ # Gradio cache/temporary files.
|
374 |
-
βββ .streamlit/ # **OLD?**: Streamlit configuration folder (App uses Gradio).
|
375 |
βββ components/ # **CRITICAL**: Directory for Gradio UI components.
|
376 |
β βββ __init__.py
|
377 |
β βββ game_recap_component.py # **CRITICAL**: Component for displaying game recaps.
|
@@ -407,13 +406,6 @@ ifx-sandbox/
|
|
407 |
βββ prompts.py # **CRITICAL**: System prompts for the agent and LLM chains.
|
408 |
βββ requirements.txt # **CRITICAL**: Main Python package dependencies.
|
409 |
βββ README.md # Main project README (check if up-to-date vs GRADIO_README).
|
410 |
-
βββ GRADIO_README.md # **OLD?**: Specific README for Gradio version? Consolidate/update.
|
411 |
-
βββ test.ipynb # **ARCHIVABLE?**: Jupyter notebook for testing (likely outdated).
|
412 |
βββ __pycache__/ # Python bytecode cache.
|
413 |
βββ .DS_Store # macOS folder metadata.
|
414 |
-
```
|
415 |
-
|
416 |
-
**Notes:**
|
417 |
-
* Files marked **CRITICAL** are essential for the current `gradio_app.py` to run with Player, Game, and Team News search features.
|
418 |
-
* Items marked **OLD?** or **ARCHIVABLE?** are potential candidates for cleanup or removal, depending on whether they are still relevant or have been superseded.
|
419 |
-
* The `data/april_11_multimedia_data_collect/` folder contains various scripts; some may be one-off data collection scripts that are no longer needed now that data is in Neo4j, but the recently moved scraper and CSV are now located here.
|
|
|
371 |
βββ .github/ # GitHub specific files (e.g., workflows - check if used).
|
372 |
βββ .gitignore # Specifies intentionally untracked files that Git should ignore.
|
373 |
βββ .gradio/ # Gradio cache/temporary files.
|
|
|
374 |
βββ components/ # **CRITICAL**: Directory for Gradio UI components.
|
375 |
β βββ __init__.py
|
376 |
β βββ game_recap_component.py # **CRITICAL**: Component for displaying game recaps.
|
|
|
406 |
βββ prompts.py # **CRITICAL**: System prompts for the agent and LLM chains.
|
407 |
βββ requirements.txt # **CRITICAL**: Main Python package dependencies.
|
408 |
βββ README.md # Main project README (check if up-to-date vs GRADIO_README).
|
|
|
|
|
409 |
βββ __pycache__/ # Python bytecode cache.
|
410 |
βββ .DS_Store # macOS folder metadata.
|
411 |
+
```
|
|
|
|
|
|
|
|
|
|
gradio_app.py
CHANGED
@@ -303,7 +303,7 @@ with gr.Blocks(title="49ers FanAI Hub", css=css) as demo:
|
|
303 |
height=500,
|
304 |
show_label=False,
|
305 |
elem_id="chatbot",
|
306 |
-
|
307 |
render_markdown=True
|
308 |
)
|
309 |
|
@@ -417,4 +417,4 @@ with gr.Blocks(title="49ers FanAI Hub", css=css) as demo:
|
|
417 |
|
418 |
# Launch the app
|
419 |
if __name__ == "__main__":
|
420 |
-
demo.launch(
|
|
|
303 |
height=500,
|
304 |
show_label=False,
|
305 |
elem_id="chatbot",
|
306 |
+
type="tuples", # this triggers a deprecation warning but OK for now
|
307 |
render_markdown=True
|
308 |
)
|
309 |
|
|
|
417 |
|
418 |
# Launch the app
|
419 |
if __name__ == "__main__":
|
420 |
+
demo.launch()
|