TooKeen commited on
Commit
2997994
·
verified ·
1 Parent(s): 653b249

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -1,7 +1,23 @@
1
  import gradio as gr
 
2
 
3
- # Lade das Modell von Hugging Face
4
- interface = gr.Interface.load("huggingface/TooKeen/neo-blockchain-assistant")
 
5
 
6
- # Starte die Gradio-App
7
- interface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import pipeline
3
 
4
+ # Laden Sie das Modell
5
+ model_name = "TooKeen/neo-blockchain-assistant"
6
+ nlp = pipeline("text-generation", model=model_name)
7
 
8
+ # Definieren Sie die Vorhersagefunktion
9
+ def predict(prompt):
10
+ result = nlp(prompt, max_length=100)
11
+ return result[0]['generated_text']
12
+
13
+ # Erstellen Sie die Gradio-Oberfläche
14
+ interface = gr.Interface(
15
+ fn=predict,
16
+ inputs=gr.Textbox(lines=2, placeholder="Geben Sie Ihren Text hier ein..."),
17
+ outputs="text",
18
+ title="Blockchain Assistant",
19
+ description="Geben Sie einen Text ein, und das Modell generiert eine Fortsetzung."
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ interface.launch()