Update app.py
Browse files
app.py
CHANGED
@@ -19,6 +19,14 @@ from datasets import load_dataset, get_dataset_config_info, Dataset
|
|
19 |
from PIL import Image
|
20 |
import time
|
21 |
import uuid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
# Page config with beautiful theme
|
24 |
st.set_page_config(
|
@@ -417,15 +425,20 @@ Groq_Token = os.getenv("GROQ_API_KEY")
|
|
417 |
hf_token = os.getenv("HF_TOKEN")
|
418 |
gemini_token = os.getenv("GEMINI_TOKEN")
|
419 |
|
|
|
420 |
models = {
|
421 |
-
"gpt-oss-20b": "openai/gpt-oss-20b",
|
422 |
"gpt-oss-120b": "openai/gpt-oss-120b",
|
423 |
-
"
|
|
|
424 |
"llama3.3": "llama-3.3-70b-versatile",
|
425 |
"deepseek-R1": "deepseek-r1-distill-llama-70b",
|
426 |
-
"
|
427 |
-
"
|
428 |
-
"gemini-
|
|
|
|
|
|
|
|
|
429 |
}
|
430 |
|
431 |
self_path = os.path.dirname(os.path.abspath(__file__))
|
@@ -550,10 +563,10 @@ if not available_models:
|
|
550 |
st.error("No API keys available! Please set up your API keys in the .env file")
|
551 |
st.stop()
|
552 |
|
553 |
-
# Set
|
554 |
default_index = 0
|
555 |
-
if "
|
556 |
-
default_index = available_models.index("
|
557 |
|
558 |
# Simple header - just title and model selector
|
559 |
col1, col2 = st.columns([3, 1])
|
@@ -935,6 +948,4 @@ if st.session_state.get("processing"):
|
|
935 |
<p style='margin: 0; font-size: 0.75rem; color: #475569;'><strong>Locations:</strong> 300+ cities across India</p>
|
936 |
<p style='margin: 0; font-size: 0.75rem; color: #475569;'><strong>Records:</strong> 100,000+ measurements</p>
|
937 |
</div>
|
938 |
-
""", unsafe_allow_html=True)
|
939 |
-
|
940 |
-
|
|
|
19 |
from PIL import Image
|
20 |
import time
|
21 |
import uuid
|
22 |
+
import asyncio
|
23 |
+
|
24 |
+
# Gemini API requires async
|
25 |
+
try:
|
26 |
+
asyncio.get_running_loop()
|
27 |
+
except RuntimeError:
|
28 |
+
loop = asyncio.new_event_loop()
|
29 |
+
asyncio.set_event_loop(loop)
|
30 |
|
31 |
# Page config with beautiful theme
|
32 |
st.set_page_config(
|
|
|
425 |
hf_token = os.getenv("HF_TOKEN")
|
426 |
gemini_token = os.getenv("GEMINI_TOKEN")
|
427 |
|
428 |
+
# Model order is decided by this
|
429 |
models = {
|
|
|
430 |
"gpt-oss-120b": "openai/gpt-oss-120b",
|
431 |
+
"gpt-oss-20b": "openai/gpt-oss-20b",
|
432 |
+
"llama4 maverik":"meta-llama/llama-4-maverick-17b-128e-instruct",
|
433 |
"llama3.3": "llama-3.3-70b-versatile",
|
434 |
"deepseek-R1": "deepseek-r1-distill-llama-70b",
|
435 |
+
"gemini-2.5-flash": "gemini-2.5-flash",
|
436 |
+
"gemini-2.5-pro": "gemini-2.5-pro",
|
437 |
+
"gemini-2.5-flash-lite": "gemini-2.5-flash-lite",
|
438 |
+
"gemini-2.0-flash": "gemini-2.0-flash",
|
439 |
+
"gemini-2.0-flash-lite": "gemini-2.0-flash-lite",
|
440 |
+
# "llama4 scout":"meta-llama/llama-4-scout-17b-16e-instruct"
|
441 |
+
# "llama3.1": "llama-3.1-8b-instant"
|
442 |
}
|
443 |
|
444 |
self_path = os.path.dirname(os.path.abspath(__file__))
|
|
|
563 |
st.error("No API keys available! Please set up your API keys in the .env file")
|
564 |
st.stop()
|
565 |
|
566 |
+
# Set GPT-OSS-120B as default if available
|
567 |
default_index = 0
|
568 |
+
if "gpt-oss-120b" in available_models:
|
569 |
+
default_index = available_models.index("gpt-oss-120b")
|
570 |
|
571 |
# Simple header - just title and model selector
|
572 |
col1, col2 = st.columns([3, 1])
|
|
|
948 |
<p style='margin: 0; font-size: 0.75rem; color: #475569;'><strong>Locations:</strong> 300+ cities across India</p>
|
949 |
<p style='margin: 0; font-size: 0.75rem; color: #475569;'><strong>Records:</strong> 100,000+ measurements</p>
|
950 |
</div>
|
951 |
+
""", unsafe_allow_html=True)
|
|
|
|