Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- .gitattributes +1 -0
- app(1).py +30 -0
- model.keras +3 -0
- requirements(1).txt +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
model.keras filter=lfs diff=lfs merge=lfs -text
|
app(1).py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import gradio as gr
|
3 |
+
from tensorflow import keras
|
4 |
+
|
5 |
+
# Load your Keras model
|
6 |
+
model = keras.models.load_model("model.keras") # Ensure this file is uploaded to the Space
|
7 |
+
|
8 |
+
# Define prediction function
|
9 |
+
def predict(input_string):
|
10 |
+
try:
|
11 |
+
# Convert user input (comma-separated) into a NumPy array
|
12 |
+
input_array = np.array([float(x.strip()) for x in input_string.split(',')])
|
13 |
+
input_array = input_array.reshape(1, -1) # Reshape for model
|
14 |
+
prediction = model.predict(input_array)
|
15 |
+
return prediction.tolist()
|
16 |
+
except Exception as e:
|
17 |
+
return f"Error: {str(e)}"
|
18 |
+
|
19 |
+
# Define Gradio interface
|
20 |
+
iface = gr.Interface(
|
21 |
+
fn=predict,
|
22 |
+
inputs=gr.Textbox(label="Enter comma-separated input values"),
|
23 |
+
outputs=gr.Textbox(label="Model Prediction"),
|
24 |
+
title="Keras Model Predictor",
|
25 |
+
description="Enter input values (e.g., 1.2, 2.4, 3.6) for prediction"
|
26 |
+
)
|
27 |
+
|
28 |
+
# Launch the app
|
29 |
+
if __name__ == "__main__":
|
30 |
+
iface.launch()
|
model.keras
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a7c19a6c65f0b40dbb4475c35df36b2da610a7d9839e2023c58cbcfb6bbdb863
|
3 |
+
size 149572
|
requirements(1).txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
tensorflow
|
3 |
+
numpy
|