Spaces:
Runtime error
Runtime error
Update chain_app.py
Browse files- chain_app.py +28 -28
chain_app.py
CHANGED
@@ -11,7 +11,7 @@ openai_api_key = os.environ.get('OPENAI_API_KEY')
|
|
11 |
groq_api_key = os.environ.get('GROQ_API_KEY')
|
12 |
|
13 |
hf_text_client = Client("Artin2009/text-generation", hf_token=hf_token)
|
14 |
-
hf_image_client = Client('Artin2009/image-generation')
|
15 |
openai_client = OpenAI(api_key=openai_api_key)
|
16 |
groq_client = Groq(api_key=groq_api_key)
|
17 |
|
@@ -38,10 +38,10 @@ async def chat_profile():
|
|
38 |
name="Dorna-AI",
|
39 |
markdown_description="One of the open-sourced models that neural brain team fine-tuned",
|
40 |
),
|
41 |
-
cl.ChatProfile(
|
42 |
-
|
43 |
-
|
44 |
-
),
|
45 |
cl.ChatProfile(
|
46 |
name="GPT-4",
|
47 |
markdown_description="OpenAI's GPT-4 model",
|
@@ -147,12 +147,12 @@ async def on_chat_start():
|
|
147 |
content='my name is Dorna, Your AI Assistant designed by neural nexus team. i was made by Artin Daneshvar and Sadra Noadoust, 2 iranian students!'
|
148 |
).send()
|
149 |
|
150 |
-
if chat_profile == 'Image-Generation':
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
if chat_profile == 'GPT-4':
|
157 |
await cl.ChatSettings(
|
158 |
[
|
@@ -439,23 +439,23 @@ async def main(message: cl.Message):
|
|
439 |
content=model_response
|
440 |
).send()
|
441 |
|
442 |
-
|
443 |
-
|
444 |
-
prompt=message.content,
|
445 |
-
negative_prompt="",
|
446 |
-
seed=0,
|
447 |
-
randomize_seed=True,
|
448 |
-
width=512,
|
449 |
-
height=512,
|
450 |
-
guidance_scale=0,
|
451 |
-
num_inference_steps=2,
|
452 |
-
api_name="/infer"
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
elif chat_profile == 'GPT-4':
|
460 |
completion = openai_client.chat.completions.create(
|
461 |
model="gpt-4",
|
|
|
11 |
groq_api_key = os.environ.get('GROQ_API_KEY')
|
12 |
|
13 |
hf_text_client = Client("Artin2009/text-generation", hf_token=hf_token)
|
14 |
+
# hf_image_client = Client('Artin2009/image-generation')
|
15 |
openai_client = OpenAI(api_key=openai_api_key)
|
16 |
groq_client = Groq(api_key=groq_api_key)
|
17 |
|
|
|
38 |
name="Dorna-AI",
|
39 |
markdown_description="One of the open-sourced models that neural brain team fine-tuned",
|
40 |
),
|
41 |
+
# cl.ChatProfile(
|
42 |
+
# name='Image-Generation',
|
43 |
+
# markdown_description='Our image generation model, has a performance like midjourney',
|
44 |
+
# ),
|
45 |
cl.ChatProfile(
|
46 |
name="GPT-4",
|
47 |
markdown_description="OpenAI's GPT-4 model",
|
|
|
147 |
content='my name is Dorna, Your AI Assistant designed by neural nexus team. i was made by Artin Daneshvar and Sadra Noadoust, 2 iranian students!'
|
148 |
).send()
|
149 |
|
150 |
+
# if chat_profile == 'Image-Generation':
|
151 |
+
# image = cl.Image(path='cat.png', name="result", display="inline")
|
152 |
+
# await cl.Message(
|
153 |
+
# content="I can make high quality & resoloution images for you, This is an example of what i can do!",
|
154 |
+
# elements=[image],
|
155 |
+
# ).send()
|
156 |
if chat_profile == 'GPT-4':
|
157 |
await cl.ChatSettings(
|
158 |
[
|
|
|
439 |
content=model_response
|
440 |
).send()
|
441 |
|
442 |
+
# elif chat_profile == 'Image-Generation':
|
443 |
+
# result = hf_image_client.predict(
|
444 |
+
# prompt=message.content,
|
445 |
+
# negative_prompt="",
|
446 |
+
# seed=0,
|
447 |
+
# randomize_seed=True,
|
448 |
+
# width=512,
|
449 |
+
# height=512,
|
450 |
+
# guidance_scale=0,
|
451 |
+
# num_inference_steps=2,
|
452 |
+
# api_name="/infer"
|
453 |
+
# )
|
454 |
+
# image = cl.Image(path=result, name="result", display="inline")
|
455 |
+
# await cl.Message(
|
456 |
+
# content="This message has an image!",
|
457 |
+
# elements=[image],
|
458 |
+
# ).send()
|
459 |
elif chat_profile == 'GPT-4':
|
460 |
completion = openai_client.chat.completions.create(
|
461 |
model="gpt-4",
|