Commit
·
6831020
1
Parent(s):
32ff4cb
2025.07.08/14:25 - Add Gradio demo
Browse files- gradio-app/app.py +20 -0
- gradio-app/requirements.txt +1 -0
gradio-app/app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import pickle
|
| 3 |
+
|
| 4 |
+
# Load the pickled model
|
| 5 |
+
with open("../double_model.pkl", "rb") as f:
|
| 6 |
+
model = pickle.load(f)
|
| 7 |
+
|
| 8 |
+
def double_number(x):
|
| 9 |
+
return model.predict(x)
|
| 10 |
+
|
| 11 |
+
demo = gr.Interface(
|
| 12 |
+
fn=double_number,
|
| 13 |
+
inputs=gr.Number(label="Enter a number"),
|
| 14 |
+
outputs=gr.Number(label="Doubled result"),
|
| 15 |
+
title="🧠 Double Model",
|
| 16 |
+
description="This demo takes a number and returns double using a toy model.",
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
demo.launch()
|
gradio-app/requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
gradio
|