Spaces:
Sleeping
Sleeping
Sumit Kumar commited on
Commit ·
039467a
1
Parent(s): 2937f6c
Refactor captcha resolution endpoint to accept image_path directly and remove unused greeting endpoint
Browse files
app.py
CHANGED
|
@@ -13,19 +13,13 @@ class Item(BaseModel):
|
|
| 13 |
def greet_json():
|
| 14 |
return {"Hello": "World!"}
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
def greet_name(name: str):
|
| 19 |
-
return {"Hello": name}
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
@app.post("/resolve_captcha")
|
| 23 |
-
def decode_captcha(item: Item):
|
| 24 |
"""
|
| 25 |
Decode the captcha image and return the text.
|
| 26 |
"""
|
| 27 |
try:
|
| 28 |
-
result = resolve_captcha(
|
| 29 |
return {"captcha_text": result}
|
| 30 |
except Exception as e:
|
| 31 |
return {"error": str(e)}
|
|
|
|
| 13 |
def greet_json():
|
| 14 |
return {"Hello": "World!"}
|
| 15 |
|
| 16 |
+
@app.get("/resolve_captcha")
|
| 17 |
+
def decode_captcha(image_path: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
"""
|
| 19 |
Decode the captcha image and return the text.
|
| 20 |
"""
|
| 21 |
try:
|
| 22 |
+
result = resolve_captcha(image_path)
|
| 23 |
return {"captcha_text": result}
|
| 24 |
except Exception as e:
|
| 25 |
return {"error": str(e)}
|