Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
API_URL = "https://api-inference.huggingface.co/models/tiiuae/falcon-7b-instruct"
|
| 2 |
+
hf_api_key = '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'
|
| 3 |
+
|
| 4 |
+
import gradio as gr
|
| 5 |
+
import requests, json
|
| 6 |
+
from text_generation import Client
|
| 7 |
+
|
| 8 |
+
#FalcomLM-instruct endpoint on the text_generation library
|
| 9 |
+
client = Client(API_URL, headers={"Authorization": f"Bearer {hf_api_key}"}, timeout=120)
|
| 10 |
+
|
| 11 |
+
def generate(input, slider):
|
| 12 |
+
output = client.generate(f' Act as a dream interpreter and analyze dreams using the psychoanalytical approach. Elaborate on the different possible interpretation and use the psychological aspects. The dream: {input}', max_new_tokens = 500).generated_text
|
| 13 |
+
return output
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
demo = gr.Interface(fn = generate, inputs = [gr.Textbox(label="Describe your dream:", lines = 6)],
|
| 17 |
+
outputs = [gr.Textbox(label="The possible meaning of your dream:", lines = 6)],
|
| 18 |
+
title = 'DreamDeep - Explore Your Inner Universe',
|
| 19 |
+
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.""",
|
| 20 |
+
|
| 21 |
+
allow_flagging = 'never')
|
| 22 |
+
|
| 23 |
+
demo.launch()
|