Spaces:
Sleeping
Sleeping
""" | |
File: requirements_app.py | |
Author: Dmitry Ryumin, Maxim Markitantov, Elena Ryumina, Anastasia Dvoynikova, and Alexey Karpov | |
Description: Project requirements for the Gradio app. | |
License: MIT License | |
""" | |
import polars as pl | |
# Importing necessary components for the Gradio app | |
from app.config import config_data | |
def read_requirements(file_path="requirements.txt"): | |
with open(file_path, "r") as file: | |
lines = file.readlines() | |
data = [] | |
def pypi(x: str) -> str: | |
return ( | |
f"<a href='https://pypi.org/project/{x}' target='_blank'>" | |
f"<img src='https://img.shields.io/pypi/v/{x}' alt='PyPI' /></a>" | |
) | |
for line in lines: | |
split_line = line.strip().split("==") | |
if len(split_line) == 2: | |
library, recommended_version = split_line | |
data.append( | |
{ | |
config_data.Requirements_LIBRARY: library, | |
config_data.Requirements_RECOMMENDED_VERSION: recommended_version, | |
config_data.Requirements_CURRENT_VERSION: pypi(library), | |
} | |
) | |
df = pl.DataFrame(data) | |
return df | |