saritha commited on
Commit
d7cd17a
1 Parent(s): 21e25fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +84 -7
app.py CHANGED
@@ -1,7 +1,44 @@
1
  import os
2
 
3
  from groq import Groq
4
- import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  client = Groq(
7
  api_key =os.getenv('api_key_gorq')
@@ -24,10 +61,46 @@ def response_from_llam3(query):
24
 
25
  )
26
  return response.choices[0].message.content
27
- iface = gr.Interface(
28
- fn=response_from_llam3,
29
- inputs="text",
30
- outputs="text",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  examples=[
32
  ['What is importance of fasting according to Ayurveda?'],
33
  ['What are the medicinal values of Tusli?'],
@@ -35,5 +108,9 @@ iface = gr.Interface(
35
  ['What is the ideal diet according to ayurveda?']
36
  ],
37
  cache_examples=False,
38
- )
39
- iface.launch()
 
 
 
 
 
1
  import os
2
 
3
  from groq import Groq
4
+ import gradio as gr
5
+
6
+ DESCRIPTION = '''
7
+ <div>
8
+ <h1 style="text-align: center;">Meta Llama3 8B</h1>
9
+ <p>This Space demonstrates the instruction-tuned model <a href="https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct"><b>Meta Llama3 8b Chat</b></a>. Meta Llama3 is the new open LLM and comes in two sizes: 8b and 70b. Feel free to play with it, or duplicate to run privately!</p>
10
+ <p>🔎 For more details about the Llama3 release and how to use the model with <code>transformers</code>, take a look <a href="https://huggingface.co/blog/llama3">at our blog post</a>.</p>
11
+ <p>🦕 Looking for an even more powerful model? Check out the <a href="https://huggingface.co/chat/"><b>Hugging Chat</b></a> integration for Meta Llama 3 70b</p>
12
+ </div>
13
+ '''
14
+
15
+ LICENSE = """
16
+ <p/>
17
+ ---
18
+ Built with Meta Llama 3
19
+ """
20
+
21
+ PLACEHOLDER = """
22
+ <div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
23
+ <img src="https://ysharma-dummy-chat-app.hf.space/file=/tmp/gradio/8e75e61cc9bab22b7ce3dec85ab0e6db1da5d107/Meta_lockup_positive%20primary_RGB.jpg" style="width: 80%; max-width: 550px; height: auto; opacity: 0.55; ">
24
+ <h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">Meta llama3</h1>
25
+ <p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Ask me anything related to Ayur Veda</p>
26
+ </div>
27
+ """
28
+
29
+
30
+ css = """
31
+ h1 {
32
+ text-align: center;
33
+ display: block;
34
+ }
35
+ #duplicate-button {
36
+ margin: auto;
37
+ color: white;
38
+ background: #1565c0;
39
+ border-radius: 100vh;
40
+ }
41
+ """
42
 
43
  client = Groq(
44
  api_key =os.getenv('api_key_gorq')
 
61
 
62
  )
63
  return response.choices[0].message.content
64
+ # iface = gr.Interface(
65
+ # fn=response_from_llam3,
66
+ # inputs="text",
67
+ # outputs="text",
68
+ # examples=[
69
+ # ['What is importance of fasting according to Ayurveda?'],
70
+ # ['What are the medicinal values of Tusli?'],
71
+ # ['What are the three different doshas?'],
72
+ # ['What is the ideal diet according to ayurveda?']
73
+ # ],
74
+ # cache_examples=False,
75
+ # )
76
+ # iface.launch()
77
+
78
+ # Gradio block
79
+ chatbot=gr.Chatbot(height=450, placeholder=PLACEHOLDER, label='Gradio ChatInterface')
80
+
81
+ with gr.Blocks(fill_height=True, css=css) as demo:
82
+
83
+ gr.Markdown(DESCRIPTION)
84
+ gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
85
+ gr.ChatInterface(
86
+ fn=response_from_llam3,
87
+ chatbot=chatbot,
88
+ fill_height=True,
89
+ additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
90
+ # additional_inputs=[
91
+ # gr.Slider(minimum=0,
92
+ # maximum=1,
93
+ # step=0.1,
94
+ # value=0.95,
95
+ # label="Temperature",
96
+ # render=False),
97
+ # gr.Slider(minimum=128,
98
+ # maximum=4096,
99
+ # step=1,
100
+ # value=512,
101
+ # label="Max new tokens",
102
+ # render=False ),
103
+ # ],
104
  examples=[
105
  ['What is importance of fasting according to Ayurveda?'],
106
  ['What are the medicinal values of Tusli?'],
 
108
  ['What is the ideal diet according to ayurveda?']
109
  ],
110
  cache_examples=False,
111
+ )
112
+
113
+ gr.Markdown(LICENSE)
114
+
115
+ if __name__ == "__main__":
116
+ demo.launch()