KvrParaskevi commited on
Commit
ce4746c
1 Parent(s): df3d0dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -1,3 +1,22 @@
1
  import gradio as gr
2
 
3
- gr.load("models/cerebras/btlm-3b-8k-chat").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ # Optional: Define a wrapper function for your model
4
+ def model_wrapper(text):
5
+ try:
6
+ # Load the model with custom code execution allowed
7
+ model = gr.load("models/cerebras/btlm-3b-8k-chat", trust_remote_code=True)
8
+ # Use the model to predict
9
+ return model(text)
10
+ except Exception as e:
11
+ # Log the exception or handle it in a user-friendly way
12
+ return f"An error occurred: {str(e)}"
13
+
14
+ # Setup Gradio interface
15
+ iface = gr.Interface(
16
+ fn=model_wrapper, # your function to expose
17
+ inputs="text", # input type
18
+ outputs="text" # output type
19
+ )
20
+
21
+ # Launch the Gradio app
22
+ iface.launch()