twn39 commited on
Commit
9d661c1
1 Parent(s): bb159c0

add init files

Browse files
Files changed (1) hide show
  1. src/app.py +40 -24
src/app.py CHANGED
@@ -13,7 +13,7 @@ def predict(message, history):
13
  for human, assistant in history:
14
  history_messages.append(HumanMessage(content=human))
15
  history_messages.append(AIMessage(content=assistant))
16
- history_messages.append(HumanMessage(content=message))
17
 
18
  response_message = ''
19
  for chunk in chat.stream(history_messages):
@@ -23,7 +23,7 @@ def predict(message, history):
23
 
24
  css = """
25
  .container {
26
- height: 100vh;
27
  }
28
  """
29
 
@@ -31,27 +31,43 @@ with gr.Blocks(css=css) as app:
31
  with gr.Tab('Chat'):
32
  with gr.Row():
33
  with gr.Column(scale=2, min_width=600):
34
- gr.ChatInterface(predict)
 
 
 
 
 
35
  with gr.Column(scale=1, min_width=300):
36
  with gr.Accordion('Select Model', open=True):
37
- gr.CheckboxGroup(
38
- choices=deep_seek_llm.support_models,
39
- type="value",
40
- label="Model",
41
- key="model",
42
- )
43
- gr.CheckboxGroup(
44
- choices=deep_seek_llm.support_models,
45
- type="value",
46
- label="Model",
47
- key="model",
48
- )
49
- gr.CheckboxGroup(
50
- choices=deep_seek_llm.support_models,
51
- type="value",
52
- label="Model",
53
- key="model",
54
- )
55
-
56
-
57
- app.launch(server_name='0.0.0.0')
 
 
 
 
 
 
 
 
 
 
 
 
13
  for human, assistant in history:
14
  history_messages.append(HumanMessage(content=human))
15
  history_messages.append(AIMessage(content=assistant))
16
+ history_messages.append(HumanMessage(content=message.text))
17
 
18
  response_message = ''
19
  for chunk in chat.stream(history_messages):
 
23
 
24
  css = """
25
  .container {
26
+ # min-height: calc(100vh - 300px);
27
  }
28
  """
29
 
 
31
  with gr.Tab('Chat'):
32
  with gr.Row():
33
  with gr.Column(scale=2, min_width=600):
34
+ gr.ChatInterface(
35
+ predict,
36
+ multimodal=True,
37
+ chatbot=gr.Chatbot(elem_id="chatbot", height=600),
38
+ textbox=gr.MultimodalTextbox(),
39
+ )
40
  with gr.Column(scale=1, min_width=300):
41
  with gr.Accordion('Select Model', open=True):
42
+ with gr.Column():
43
+ gr.Dropdown(
44
+ choices=deep_seek_llm.support_models,
45
+ type="value",
46
+ label="Model",
47
+ key="model",
48
+ )
49
+ gr.Slider(
50
+ minimum=0.0,
51
+ maximum=1.0,
52
+ step=0.1,
53
+ label="Temperature",
54
+ key="temperature",
55
+ )
56
+ gr.Number(
57
+ minimum=1024,
58
+ maximum=1024 * 20,
59
+ step=128,
60
+ value=4096,
61
+ label="Max Tokens",
62
+ key="max_tokens",
63
+ )
64
+
65
+ with gr.Tab('Text to Image'):
66
+ with gr.Row():
67
+ with gr.Column(scale=2, min_width=600):
68
+ gr.Image(label="Input Image")
69
+ with gr.Column(scale=1, min_width=300):
70
+ gr.Textbox(label="LoRA")
71
+
72
+
73
+ app.launch(debug=True)