安装了gradio后运行任何gradio代码后,打开浏览器后都显示loading没反应,这是因为外网原因,修改代码即可解决。具体方法为:
打开安装环境中的/site_packages/gradio/themes/utils/fonts.py
注释掉这个网址: https://fonts.googleapis.com/
from :
class GoogleFont(Font):
def __init__(self, name: str, weights: Iterable[int] = (400, 600)):
self.name = name
self.weights = weights
def stylesheet(self) -> str:
return f'https://fonts.googleapis.com/css2?family={self.name.replace(" ", "+")}:wght@{";".join(str(weight) for weight in self.weights)}&display=swap'
to :
``
class` GoogleFont(Font):
def __init__(self, name: str, weights: Iterable[int] = (400, 600)):
self.name = name
self.weights = weights
def stylesheet(self) -> str:
pass
#return f'https://fonts.googleapis.com/css2?family={self.name.replace(" ", "+")}:wght@{";".join(str(weight) for weight in self.weights)}&display=swap'