import traceback
import logging
from typing import Optional
import spaces
import gradio as gr
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
handler = logging.StreamHandler()
logger.addHandler(handler)
print("here")
logger.warning(f"The repository is downloading to: {local_dir}")
MARKDOWN = """
Magma: A Foundation Model for Multimodal AI Agents
[Jianwei Yang](https://jwyang.github.io/)*1†
[Reuben Tan](https://cs-people.bu.edu/rxtan/)1†
[Qianhui Wu](https://qianhuiwu.github.io/)1†
[Ruijie Zheng](https://ruijiezheng.com/)2‡
[Baolin Peng](https://scholar.google.com/citations?user=u1CNjgwAAAAJ&hl=en&oi=ao)1‡
[Yongyuan Liang](https://cheryyunl.github.io)2‡
[Yu Gu](https://users.umiacs.umd.edu/~hal/)1
[Mu Cai](https://pages.cs.wisc.edu/~mucai/)3
[Seonghyeon Ye](https://seonghyeonye.github.io/)4
[Joel Jang](https://joeljang.github.io/)5
[Yuquan Deng](https://scholar.google.com/citations?user=LTC0Q6YAAAAJ&hl=en)5
[Lars Liden](https://sites.google.com/site/larsliden)1
[Jianfeng Gao](https://www.microsoft.com/en-us/research/people/jfgao/)1▽
1 Microsoft Research; 2 University of Maryland; 3 University of Wisconsin-Madison; 4 KAIST; 5 University of Washington
* Project lead † First authors ‡ Second authors ▽ Leadership
\[[arXiv Paper](https://www.arxiv.org/pdf/2502.13130)\] \[[Project Page](https://microsoft.github.io/Magma/)\] \[[Github Repo](https://github.com/microsoft/Magma)\] \[[Hugging Face Model](https://huggingface.co/microsoft/Magma-8B)\]
This demo is powered by [Gradio](https://gradio.app/) and uses OmniParserv2 to generate Set-of-Mark prompts.
"""
logger.warning("Starting App.")
with gr.Blocks() as demo:
gr.Markdown(MARKDOWN)
# demo.launch(debug=True, show_error=True, share=True)
# demo.launch(share=True, server_port=7861, server_name='0.0.0.0')
demo.queue().launch(share=False)