prithivMLmods commited on
Commit
c4d588e
1 Parent(s): 953762b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  import sambanova_gradio
3
 
4
- # Define a function to load the selected model
5
  def load_model(model_choice):
6
  model = gr.load(
7
  name=model_choice,
@@ -9,6 +9,12 @@ def load_model(model_choice):
9
  )
10
  return model
11
 
 
 
 
 
 
 
12
  # Available model choices
13
  model_choices = [
14
  "Meta-Llama-3.2-1B-lnstruct",
@@ -49,13 +55,8 @@ with gr.Blocks() as demo:
49
  )
50
 
51
  # Action when button is clicked
52
- def generate_response(model_choice, user_input):
53
- model = load_model(model_choice)
54
- output = model.predict(user_input)
55
- return output
56
-
57
  generate_button.click(
58
- generate_response,
59
  inputs=[model_choice, input_box],
60
  outputs=output_box
61
  )
 
1
  import gradio as gr
2
  import sambanova_gradio
3
 
4
+ # Function to load the selected model
5
  def load_model(model_choice):
6
  model = gr.load(
7
  name=model_choice,
 
9
  )
10
  return model
11
 
12
+ # Define a function to handle the user input and return a response
13
+ def generate_response(model_choice, user_input):
14
+ model = load_model(model_choice)
15
+ output = model.predict(user_input)
16
+ return output
17
+
18
  # Available model choices
19
  model_choices = [
20
  "Meta-Llama-3.2-1B-lnstruct",
 
55
  )
56
 
57
  # Action when button is clicked
 
 
 
 
 
58
  generate_button.click(
59
+ fn=generate_response,
60
  inputs=[model_choice, input_box],
61
  outputs=output_box
62
  )