Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import google.genai as genai
|
|
|
3 |
from PIL import Image
|
4 |
import os
|
5 |
import textract
|
@@ -117,15 +118,19 @@ def single_submit_func(prompt, files, model, temperature, top_p, max_tokens, api
|
|
117 |
inputs = [prompt] + processed_inputs
|
118 |
warning = ""
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
127 |
try:
|
128 |
-
response = client.models.generate_content(
|
129 |
response_text = warning
|
130 |
response_images = []
|
131 |
|
|
|
1 |
import gradio as gr
|
2 |
import google.genai as genai
|
3 |
+
from google.genai import types
|
4 |
from PIL import Image
|
5 |
import os
|
6 |
import textract
|
|
|
118 |
inputs = [prompt] + processed_inputs
|
119 |
warning = ""
|
120 |
|
121 |
+
contents = [
|
122 |
+
types.Content(
|
123 |
+
role="user",
|
124 |
+
parts=[
|
125 |
+
types.Part.from_text(text=prompt),
|
126 |
+
],
|
127 |
+
),
|
128 |
+
]
|
129 |
+
generate_content_config = types.GenerateContentConfig(
|
130 |
+
response_mime_type="text/plain",
|
131 |
+
)
|
132 |
try:
|
133 |
+
response = client.models.generate_content(model=model, contents=contents, config=generation_config)
|
134 |
response_text = warning
|
135 |
response_images = []
|
136 |
|