stummala521 commited on
Commit
9e6875e
·
1 Parent(s): bd9258e

tst inference

Browse files
Files changed (1) hide show
  1. app.py +15 -8
app.py CHANGED
@@ -1,11 +1,19 @@
1
  import gradio as gr
2
  import joblib
3
- from skops import hub_utils
 
4
 
5
- hub_utils.download(repo_id="stummala521/AI4SAR", dst="model.pkl")
6
- model = joblib.load(
7
- "model.pkl"
8
- )
 
 
 
 
 
 
 
9
 
10
  test_data = {
11
  "location_found_elevation": 1500,
@@ -15,8 +23,7 @@ test_data = {
15
  output = model.predict([test_data])
16
 
17
  def greet(name):
18
- return "Hello " + name + "!" + output
19
 
20
  demo = gr.Interface(fn=greet, inputs="text", outputs="text")
21
- demo.launch()
22
-
 
1
  import gradio as gr
2
  import joblib
3
+ import requests
4
+ import os
5
 
6
+ # Download the model file
7
+ model_url = "https://huggingface.co/stummala521/AI4SAR/resolve/main/model.pkl"
8
+ local_filename = "model.pkl"
9
+
10
+ # Download the file
11
+ response = requests.get(model_url, allow_redirects=True)
12
+ with open(local_filename, 'wb') as f:
13
+ f.write(response.content)
14
+
15
+ # Load the model
16
+ model = joblib.load(local_filename)
17
 
18
  test_data = {
19
  "location_found_elevation": 1500,
 
23
  output = model.predict([test_data])
24
 
25
  def greet(name):
26
+ return "Hello " + name + "!" + str(output[0])
27
 
28
  demo = gr.Interface(fn=greet, inputs="text", outputs="text")
29
+ demo.launch()