Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,18 @@ from huggingface_hub import InferenceClient
|
|
| 4 |
"""
|
| 5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 6 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 8 |
|
| 9 |
|
|
|
|
| 4 |
"""
|
| 5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 6 |
"""
|
| 7 |
+
from transformers import pipeline
|
| 8 |
+
|
| 9 |
+
model_name = "EleutherAI/gpt-j-6B"
|
| 10 |
+
generator = pipeline("text-generation", model=model_name)
|
| 11 |
+
|
| 12 |
+
def generate_text(prompt):
|
| 13 |
+
return generator(prompt, max_length=50)[0]["generated_text"]
|
| 14 |
+
|
| 15 |
+
interface = gr.Interface(fn=generate_text, inputs="text", outputs="text")
|
| 16 |
+
interface.launch()
|
| 17 |
+
|
| 18 |
+
|
| 19 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
| 20 |
|
| 21 |
|