Spaces:
Sleeping
Sleeping
from smolagents import Tool | |
translator = Tool.from_space( | |
"UNESCO/nllb", | |
name="translator", | |
description=""" | |
Translates input text from a source language to a target language. | |
Parameters: | |
----------- | |
text : str | |
The input value that is provided in the "Input Text" Textbox component. | |
src_lang : Literal[ | |
'Acehnese (Arabic script)', 'Acehnese (Latin script)', 'Afrikaans', 'Akan', 'Amharic', | |
'Armenian', 'Assamese', 'Asturian', 'Awadhi', 'Ayacucho Quechua', 'Balinese', 'Bambara', | |
'Banjar (Arabic script)', 'Banjar (Latin script)', 'Bashkir', 'Basque', 'Belarusian', | |
'Bemba', 'Bengali', 'Bhojpuri', 'Bosnian', 'Buginese', 'Bulgarian', 'Burmese', 'Catalan', | |
'Cebuano', 'Central Atlas Tamazight', 'Central Aymara', 'Central Kanuri (Arabic script)', | |
'Central Kanuri (Latin script)', 'Central Kurdish', 'Chhattisgarhi', 'Chinese (Simplified)', | |
'Chinese (Traditional)', 'Chokwe', 'Crimean Tatar', 'Croatian', 'Czech', 'Danish', 'Dari', | |
'Dutch', 'Dyula', 'Dzongkha', 'Eastern Panjabi', 'Eastern Yiddish', 'Egyptian Arabic', | |
'English', 'Esperanto', 'Estonian', 'Ewe', 'Faroese', 'Fijian', 'Finnish', 'Fon', 'French', | |
'Friulian', 'Galician', 'Ganda', 'Georgian', 'German', 'Greek', 'Guarani', 'Gujarati', | |
'Haitian Creole', 'Halh Mongolian', 'Hausa', 'Hebrew', 'Hindi', 'Hungarian', 'Icelandic', | |
'Igbo', 'Ilocano', 'Indonesian', 'Irish', 'Italian', 'Japanese', 'Javanese', 'Jingpho', | |
'Kabiyè', 'Kabuverdianu', 'Kabyle', 'Kamba', 'Kannada', 'Kashmiri (Arabic script)', | |
'Kashmiri (Devanagari script)', 'Kazakh', 'Khmer', 'Kikongo', 'Kikuyu', 'Kimbundu', | |
'Kinyarwanda', 'Korean', 'Kyrgyz', 'Lao', 'Latgalian', 'Ligurian', 'Limburgish', 'Lingala', | |
'Lithuanian', 'Lombard', 'Luba-Kasai', 'Luo', 'Luxembourgish', 'Macedonian', 'Magahi', | |
'Maithili', 'Malayalam', 'Maltese', 'Maori', 'Marathi', 'Meitei (Bengali script)', | |
'Mesopotamian Arabic', 'Minangkabau (Latin script)', 'Mizo', 'Modern Standard Arabic', | |
'Moroccan Arabic', 'Mossi', 'Najdi Arabic', 'Nepali', 'Nigerian Fulfulde', | |
'North Azerbaijani', 'North Levantine Arabic', 'Northern Kurdish', 'Northern Sotho', | |
'Northern Uzbek', 'Norwegian Bokmål', 'Norwegian Nynorsk', 'Nuer', 'Nyanja', 'Occitan', | |
'Odia', 'Pangasinan', 'Papiamento', 'Plateau Malagasy', 'Polish', 'Portuguese', 'Romanian', | |
'Rundi', 'Russian', 'Samoan', 'Sango', 'Sanskrit', 'Santali', 'Sardinian', 'Scottish Gaelic', | |
'Serbian', 'Shan', 'Shona', 'Sicilian', 'Silesian', 'Sindhi', 'Sinhala', 'Slovak', | |
'Slovenian', 'Somali', 'South Azerbaijani', 'South Levantine Arabic', 'Southern Pashto', | |
'Southern Sotho', 'Southwestern Dinka', 'Spanish', 'Standard Latvian', 'Standard Malay', | |
'Standard Tibetan', 'Sundanese', 'Swahili', 'Swati', 'Swedish', 'Tagalog', 'Tajik', | |
'Tamasheq (Latin script)', 'Tamasheq (Tifinagh script)', 'Tamil', 'Tatar', | |
'Ta’izzi-Adeni Arabic', 'Telugu', 'Thai', 'Tigrinya', 'Tok Pisin', 'Tosk Albanian', | |
'Tsonga', 'Tswana', 'Tumbuka', 'Tunisian Arabic', 'Turkish', 'Turkmen', 'Twi', 'Ukrainian', | |
'Umbundu', 'Urdu', 'Uyghur', 'Venetian', 'Vietnamese', 'Waray', 'Welsh', | |
'West Central Oromo', 'Western Persian', 'Wolof', 'Xhosa', 'Yoruba', 'Yue Chinese', 'Zulu' | |
] | |
The input value that is provided in the "Source Language" Dropdown component. | |
tgt_lang : Same as src_lang | |
The input value that is provided in the "Target Language" Dropdown component. | |
Returns: | |
-------- | |
str | |
The translated output value that appears in the "Output Text" Textbox component. | |
""") | |
image_qa= Tool.from_space( | |
"microsoft/Magma-UI", | |
name="image_qa", | |
description=""" | |
Processes an input image and extracts structured information based on detection and OCR parameters. | |
Parameters: | |
----------- | |
image_input : filepath | |
The input value provided in the "Upload image" Image component. | |
box_threshold : float, optional (default=0.05) | |
The threshold used to filter detected boxes, provided via the "Box Threshold" Slider component. | |
iou_threshold : float, optional (default=0.1) | |
The Intersection over Union (IOU) threshold used for non-max suppression, set via the "IOU Threshold" Slider component. | |
use_paddleocr : bool, optional (default=True) | |
A flag indicating whether to use PaddleOCR for text extraction, controlled by the "Use PaddleOCR" Checkbox component. | |
imgsz : float, optional (default=640) | |
The image resolution used during detection, set via the "Icon Detect Image Size" Slider component. | |
instruction : str | |
The instruction or prompt provided in the "Text Input" Textbox component. | |
Returns: | |
-------- | |
tuple | |
A tuple containing: | |
- filepath : str | |
The output image filepath displayed in the "Image Output" Image component. | |
- str | |
The parsed text or screen element description shown in the "Parsed screen elements" Textbox component. | |
""" | |
) | |