Spaces:
Sleeping
Sleeping
Update README.md
Browse files- .github/README.md +64 -3
.github/README.md
CHANGED
|
@@ -1,6 +1,67 @@
|
|
| 1 |
-
# Gemini
|
| 2 |
-
A prototype of a Gemini 1.5 Flash chatbot with Tooluse using
|
| 3 |
|
| 4 |
https://huggingface.co/spaces/xarical/Gemini-Tooluse-Prototype
|
| 5 |
|
| 6 |
-

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Gemini Tooluse Prototype
|
| 2 |
+
A prototype of a Gemini 1.5 Flash chatbot with Tooluse using Flask, Gradio, Playwright, and Nginx. It can use a calculator, get the current date and time, and search the web (via Bing) using Playwright.
|
| 3 |
|
| 4 |
https://huggingface.co/spaces/xarical/Gemini-Tooluse-Prototype
|
| 5 |
|
| 6 |
+

|
| 7 |
+
|
| 8 |
+
## Running locally
|
| 9 |
+
|
| 10 |
+
In config.py, replace:
|
| 11 |
+
```python
|
| 12 |
+
tools_external_url = f"https://{os.environ['SPACE_HOST']}/tools"
|
| 13 |
+
```
|
| 14 |
+
With:
|
| 15 |
+
```python
|
| 16 |
+
tools_external_url = f"http://localhost:3000"
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
Then, in the terminal:
|
| 20 |
+
```bash
|
| 21 |
+
# Create and enter a virtual environment
|
| 22 |
+
python -m venv venv
|
| 23 |
+
source venv/bin/activate
|
| 24 |
+
|
| 25 |
+
# Install Python dependencies
|
| 26 |
+
pip install -r requirements.txt
|
| 27 |
+
|
| 28 |
+
# Install Node.js dependencies
|
| 29 |
+
npm install
|
| 30 |
+
|
| 31 |
+
# Install Playwright dependencies
|
| 32 |
+
npx playwright install
|
| 33 |
+
|
| 34 |
+
# Run the app
|
| 35 |
+
bash run.sh
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
The app will be available at http://localhost:7860 if nginx succesfully started, http://localhost:8080 otherwise.
|
| 39 |
+
|
| 40 |
+
## Deploying
|
| 41 |
+
|
| 42 |
+
### Hugging Face Spaces
|
| 43 |
+
1. Create a new Space in Hugging Face.
|
| 44 |
+
2. Set any required secrets (e.g., `GEMINI_API_KEY`) in your Space settings.
|
| 45 |
+
3. Push the files in this repository to your Hugging Face Space:
|
| 46 |
+
```shell
|
| 47 |
+
git clone https://github.com/xarical/Gemini-Tooluse-Prototype
|
| 48 |
+
git remote add space https://YOUR_USERNAME:YOUR_ACCESS_TOKEN@huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
|
| 49 |
+
git push --force space main
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
## Project files
|
| 53 |
+
- `config.py` - Configuration for hosts, ports, and system prompt
|
| 54 |
+
- `Dockerfile` - Dockerfile for Hugging Face deployment
|
| 55 |
+
- `nginx.conf` - nginx config for Hugging Face deployment
|
| 56 |
+
- `README.md` - You are here!
|
| 57 |
+
- `requirements.txt` - Python dependencies
|
| 58 |
+
- `package.json` - Node.js dependencies
|
| 59 |
+
- `package-lock.json` - Node.js lockfile
|
| 60 |
+
- `playwright_service.js` - Node.js service for browser-based web search
|
| 61 |
+
- `tools.py` - Flask API for datetime, calculator, and websearch tools
|
| 62 |
+
- `app.py` - Main Gemini chatbot app (Flask + Gradio)
|
| 63 |
+
- `run.sh` - Shell script to start all services
|
| 64 |
+
|
| 65 |
+
### `.github/workflows/`
|
| 66 |
+
- `checkfilesizes.yml` - Check file sizes for pull requests (LFS)
|
| 67 |
+
- `deploytospace.yml` - Deploy to Hugging Face Space automatically
|