Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
-
API_URL = "https://api-inference.huggingface.co/models/tiiuae/falcon-7b-instruct"
|
| 2 |
-
|
| 3 |
import os
|
| 4 |
-
hf_api_key = os.environ["hf_api_key"]
|
| 5 |
-
|
| 6 |
import gradio as gr
|
| 7 |
import requests, json
|
| 8 |
from text_generation import Client
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
#FalcomLM-instruct endpoint on the text_generation library
|
| 11 |
client = Client(API_URL, headers={"Authorization": f"Bearer {hf_api_key}"}, timeout=120)
|
| 12 |
|
| 13 |
def generate(input):
|
| 14 |
-
output = client.generate(
|
| 15 |
return output
|
| 16 |
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
|
|
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import requests, json
|
| 4 |
from text_generation import Client
|
| 5 |
|
| 6 |
+
hf_api_key = os.environ["hf_api_key"]
|
| 7 |
+
API_URL = os.environ["API_URL"]
|
| 8 |
+
prompt = os.environ["prompt"]
|
| 9 |
+
|
| 10 |
#FalcomLM-instruct endpoint on the text_generation library
|
| 11 |
client = Client(API_URL, headers={"Authorization": f"Bearer {hf_api_key}"}, timeout=120)
|
| 12 |
|
| 13 |
def generate(input):
|
| 14 |
+
output = client.generate(prompt, max_new_tokens = 500).generated_text
|
| 15 |
return output
|
| 16 |
|
| 17 |
|