Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
|
|
5 |
|
6 |
-
#
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|