hugging space upload
Browse files- README.md +39 -28
- app.py +5 -35
- index.html +14 -0
- vibes.html +14 -0
README.md
CHANGED
@@ -1,40 +1,51 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
## Setup
|
11 |
|
12 |
-
1.
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
2. Install dependencies:
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
3.
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
Then edit `.env` and add your OpenRouter API key
|
28 |
|
29 |
## Usage
|
30 |
|
31 |
-
1.
|
32 |
-
2.
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
38 |
|
39 |
## Features
|
40 |
|
|
|
1 |
+
---
|
2 |
+
title: Vibesmark Test Suite
|
3 |
+
emoji: 🎯
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: purple
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 4.0.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
11 |
+
|
12 |
+
# Vibesmark Test Suite
|
13 |
+
|
14 |
+
A benchmarking tool for comparing different language models side by side. This application allows users to:
|
15 |
+
|
16 |
+
- Upload custom test questions
|
17 |
+
- Compare responses from different language models
|
18 |
+
- Record preferences between model outputs
|
19 |
+
- Generate summary statistics of model performance
|
20 |
|
21 |
## Setup
|
22 |
|
23 |
+
1. Create a `.env` file with your OpenRouter API credentials:
|
24 |
+
```
|
25 |
+
OPENROUTER_API_KEY=your_api_key_here
|
26 |
+
OPENROUTER_BASE_URL=https://openrouter.ai/api/v1/chat/completions
|
27 |
+
```
|
28 |
|
29 |
2. Install dependencies:
|
30 |
+
```bash
|
31 |
+
pip install -r requirements.txt
|
32 |
+
```
|
33 |
|
34 |
+
3. Run the application:
|
35 |
+
```bash
|
36 |
+
python app.py
|
37 |
+
```
|
|
|
38 |
|
39 |
## Usage
|
40 |
|
41 |
+
1. Select two models to compare
|
42 |
+
2. Upload a text file containing test questions (one per line)
|
43 |
+
3. Start the test and evaluate responses
|
44 |
+
4. View results summary when finished
|
45 |
+
|
46 |
+
## Deployment
|
47 |
+
|
48 |
+
This app is ready to deploy on Hugging Face Spaces. Just add your OpenRouter API credentials as secrets in your Space settings.
|
49 |
|
50 |
## Features
|
51 |
|
app.py
CHANGED
@@ -41,10 +41,10 @@ MODELS = [
|
|
41 |
|
42 |
# Get configuration from environment variables
|
43 |
OPENROUTER_API_KEY = os.getenv('OPENROUTER_API_KEY')
|
44 |
-
OPENROUTER_BASE_URL = os.getenv('OPENROUTER_BASE_URL')
|
45 |
|
46 |
-
if not OPENROUTER_API_KEY
|
47 |
-
raise ValueError("Missing
|
48 |
|
49 |
def get_response(question, model):
|
50 |
"""Get response from OpenRouter API for the given question and model."""
|
@@ -120,7 +120,7 @@ with gr.Blocks(title="Vibesmark Test Suite") as demo:
|
|
120 |
model1_selector = gr.Dropdown(
|
121 |
choices={model["model_id"]: model["display_name"] for model in MODELS},
|
122 |
label="Select First Model",
|
123 |
-
value="
|
124 |
type="value",
|
125 |
allow_custom_value=False
|
126 |
)
|
@@ -651,34 +651,4 @@ demo.queue()
|
|
651 |
|
652 |
# Launch with the appropriate host setting for deployment
|
653 |
if __name__ == "__main__":
|
654 |
-
|
655 |
-
print("You can access the app at: http://localhost:7860")
|
656 |
-
|
657 |
-
# Create a FastAPI app to serve the example file
|
658 |
-
from fastapi import FastAPI
|
659 |
-
from fastapi.responses import FileResponse
|
660 |
-
from fastapi.middleware.cors import CORSMiddleware
|
661 |
-
|
662 |
-
app = FastAPI()
|
663 |
-
|
664 |
-
# Add CORS middleware
|
665 |
-
app.add_middleware(
|
666 |
-
CORSMiddleware,
|
667 |
-
allow_origins=["*"],
|
668 |
-
allow_credentials=True,
|
669 |
-
allow_methods=["*"],
|
670 |
-
allow_headers=["*"],
|
671 |
-
)
|
672 |
-
|
673 |
-
@app.get("/testquestions.txt")
|
674 |
-
async def get_example_file():
|
675 |
-
return FileResponse("testquestions.txt")
|
676 |
-
|
677 |
-
# Mount FastAPI app to Gradio
|
678 |
-
demo.app.mount("/", app)
|
679 |
-
|
680 |
-
demo.launch(
|
681 |
-
server_name="0.0.0.0", # Allows external connections
|
682 |
-
server_port=7860,
|
683 |
-
share=False
|
684 |
-
)
|
|
|
41 |
|
42 |
# Get configuration from environment variables
|
43 |
OPENROUTER_API_KEY = os.getenv('OPENROUTER_API_KEY')
|
44 |
+
OPENROUTER_BASE_URL = os.getenv('OPENROUTER_BASE_URL', 'https://openrouter.ai/api/v1/chat/completions')
|
45 |
|
46 |
+
if not OPENROUTER_API_KEY:
|
47 |
+
raise ValueError("Missing OPENROUTER_API_KEY. Please set it in your environment variables or .env file.")
|
48 |
|
49 |
def get_response(question, model):
|
50 |
"""Get response from OpenRouter API for the given question and model."""
|
|
|
120 |
model1_selector = gr.Dropdown(
|
121 |
choices={model["model_id"]: model["display_name"] for model in MODELS},
|
122 |
label="Select First Model",
|
123 |
+
value="openai/gpt-4-turbo-preview",
|
124 |
type="value",
|
125 |
allow_custom_value=False
|
126 |
)
|
|
|
651 |
|
652 |
# Launch with the appropriate host setting for deployment
|
653 |
if __name__ == "__main__":
|
654 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index.html
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta http-equiv="refresh" content="0; url=https://atin.me">
|
6 |
+
<title>Redirecting...</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<p>If you are not redirected automatically, <a href="https://atin.me">click here</a>.</p>
|
10 |
+
<script>
|
11 |
+
window.location.href = "https://atin.me";
|
12 |
+
</script>
|
13 |
+
</body>
|
14 |
+
</html>
|
vibes.html
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta http-equiv="refresh" content="0; url=https://132d16866af07e9973.gradio.live">
|
6 |
+
<title>Redirecting...</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<p>If you are not redirected automatically, <a href="https://132d16866af07e9973.gradio.live">click here</a>.</p>
|
10 |
+
<script>
|
11 |
+
window.location.href = "https://132d16866af07e9973.gradio.live";
|
12 |
+
</script>
|
13 |
+
</body>
|
14 |
+
</html>
|