cakemus commited on
Commit
f404d24
·
1 Parent(s): b935e3d
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -1,7 +1,16 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # Load a simple model (fill-mask task as an example)
5
+ model = pipeline("fill-mask", model="distilroberta-base")
6
 
7
+ # Define the function to use the GPU
8
+ def predict(text):
9
+ return model(text)
10
+
11
+ # Gradio Interface
12
+ interface = gr.Interface(fn=predict, inputs="text", outputs="text")
13
+
14
+ # Launch the interface
15
+ if __name__ == "__main__":
16
+ interface.launch()