Spaces:
Sleeping
Sleeping
Update Image_text_generation.py
Browse files- Image_text_generation.py +0 -11
Image_text_generation.py
CHANGED
|
@@ -54,15 +54,4 @@ class Image_text_Generator:
|
|
| 54 |
except Exception as e:
|
| 55 |
print(f"圖片上傳失敗: {e}")
|
| 56 |
return None
|
| 57 |
-
|
| 58 |
-
def generate_txt_with_gemini(self, prompt,doc_url):
|
| 59 |
-
doc_data = httpx.get(doc_url).content
|
| 60 |
-
|
| 61 |
-
response = genai_client.models.generate_content(
|
| 62 |
-
model="gemini-2.0-flash",
|
| 63 |
-
contents=[
|
| 64 |
-
types.Part.from_bytes(data=doc_data, mime_type='application/pdf',),prompt]
|
| 65 |
-
)
|
| 66 |
-
|
| 67 |
-
return response.text
|
| 68 |
|
|
|
|
| 54 |
except Exception as e:
|
| 55 |
print(f"圖片上傳失敗: {e}")
|
| 56 |
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|