Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +38 -0
- requirements.txt +7 -0
- tld_hype_index.joblib +3 -0
app.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import joblib
|
| 5 |
+
|
| 6 |
+
# --- Step 1: Load the pre-calculated Hype Index data ---
|
| 7 |
+
print("Loading TLD Hype Index data...")
|
| 8 |
+
try:
|
| 9 |
+
tld_hype_index = joblib.load('tld_hype_index.joblib')
|
| 10 |
+
# Convert the Series to a DataFrame for better display
|
| 11 |
+
hype_df = tld_hype_index.reset_index()
|
| 12 |
+
hype_df.columns = ['TLD', 'Hype Index (0-100)']
|
| 13 |
+
hype_df['Hype Index (0-100)'] = hype_df['Hype Index (0-100)'].round(2)
|
| 14 |
+
print("✅ Hype Index data loaded and formatted.")
|
| 15 |
+
except FileNotFoundError:
|
| 16 |
+
print("❌ ERROR: Data file not found. Make sure 'tld_hype_index.joblib' is uploaded to the Space.")
|
| 17 |
+
hype_df = pd.DataFrame({'Error': ['tld_hype_index.joblib file not found. Please run the training script and upload the file.']})
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# --- Step 2: Define the function to display the data ---
|
| 21 |
+
# This function doesn't need any inputs; it just returns the DataFrame we loaded.
|
| 22 |
+
def display_hype_index():
|
| 23 |
+
return hype_df
|
| 24 |
+
|
| 25 |
+
# --- Step 3: Create and launch the Gradio web interface ---
|
| 26 |
+
iface = gr.Interface(
|
| 27 |
+
fn=display_hype_index,
|
| 28 |
+
inputs=None, # No user input needed for this app
|
| 29 |
+
outputs=gr.DataFrame(headers=['TLD', 'Hype Index (0-100)'], datatype=['str', 'number']),
|
| 30 |
+
title="Doma TLD Trend & Hype Analyzer (Model 3)",
|
| 31 |
+
description="This tool analyzes the recent tokenization activity on the Doma Protocol to generate a 'Hype Index' for Top-Level Domains (TLDs). A higher score indicates more recent momentum and popularity.",
|
| 32 |
+
live=False, # The app doesn't need to run in real-time
|
| 33 |
+
allow_flagging="never"
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
# Launch the app
|
| 37 |
+
if __name__ == "__main__":
|
| 38 |
+
iface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
requests
|
| 2 |
+
pandas
|
| 3 |
+
scikit-learn==1.3.2
|
| 4 |
+
numpy
|
| 5 |
+
joblib
|
| 6 |
+
gradio
|
| 7 |
+
tqdm
|
tld_hype_index.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:58fae73d917078871c904657fb4fbe75ac58a7043ee0e756a0b57323ce1f4c4a
|
| 3 |
+
size 1320
|