|
|
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"] |
|
|
|
|
|
|
|
|
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() |