tbelvin5969 commited on
Commit
ff3f23a
·
verified ·
1 Parent(s): 5ba9259

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1,9 +1,13 @@
1
  import gradio as gr
 
2
 
3
- def predict(image):
4
- # Replace with your model inference code
5
- return "Insect detected: Example species"
6
 
7
- iface = gr.Interface(fn=predict, inputs=gr.Image(type="pil"), outputs="text")
 
8
 
 
 
9
  iface.launch()
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # Load model
5
+ model_name = "Genius-Society/insecta"
6
+ insecta_pipeline = pipeline("text-generation", model=model_name)
7
 
8
+ def generate_response(prompt):
9
+ return insecta_pipeline(prompt, max_length=100)[0]['generated_text']
10
 
11
+ # Gradio interface
12
+ iface = gr.Interface(fn=generate_response, inputs="text", outputs="text")
13
  iface.launch()