File size: 1,098 Bytes
f4914b5 3ed210e 6b8cd3c 3ed210e 4be9ba0 c328b26 3ed210e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import os
import gradio as gr
import requests, json
from text_generation import Client
hf_api_key = os.environ["hf_api_key"]
API_URL = os.environ["API_URL"]
prompt = os.environ["prompt"]
#FalcomLM-instruct endpoint on the text_generation library
client = Client(API_URL, headers={"Authorization": f"Bearer {hf_api_key}"}, timeout=120)
def generate(input):
output = client.generate(prompt + f'{input}', max_new_tokens = 500).generated_text
return output
demo = gr.Interface(fn = generate, inputs = [gr.Textbox(label="Describe your dream:", lines = 6)],
outputs = [gr.Textbox(label="The possible meaning of your dream:", lines = 6)],
title = 'DreamDeep - Explore Your Inner Universe',
description = """Unlock the hidden depths of your mind with DreamDeep, the revolutionary dream interpretation app. Guided by advanced Artificial Intelligence, DreamDeep empowers you to explore the mysteries of your subconscious mind while you sleep.""",
allow_flagging = 'never')
demo.launch() |